• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            TOJ 2553 Japan

             1 /* 
             2  * File:   H.cpp
             3  * Author: GongZhi
             4  * Problem:
             5  * Created on 2009年7月27日, 上午9:41
             6  */
             7 
             8 #include <stdlib.h>
             9 #include <string.h>
            10 #include <iostream>
            11 #include <string>
            12 #include <vector>
            13 #include <map>
            14 #include <queue>
            15 #include <algorithm>
            16 using namespace std;
            17 const int MAX=1100;
            18 struct node{
            19     int x,y;
            20 }data[MAX*MAX];
            21 int n,m;
            22 long long seg[MAX];
            23 bool cmp(node a, node b)
            24 {
            25     return a.x<b.x||a.x==b.x&&a.y<b.y;
            26 }
            27 /*
            28  *
            29  */
            30 int lowbit(int x)
            31 {
            32     return x^(x&(x-1));
            33 }
            34 
            35 int add(int x,int d)
            36 {
            37     while(x<=m)
            38     {
            39         seg[x]+=d;
            40         x+=lowbit(x);
            41     }
            42     return 0;
            43 }
            44 
            45 long long sum(int x)
            46 {
            47     long long ans=0;
            48     while(x>0)
            49     {
            50         ans+=seg[x];
            51         x-=lowbit(x);
            52     }
            53     return ans;
            54 }
            55 
            56 int main() {
            57     int kase;
            58     int k,l;
            59     scanf("%d",&kase);
            60     for(k=1;k<=kase;k++){
            61         scanf("%d%d%d",&n,&m,&l);
            62         for(int i=0;i<l;++i)
            63             scanf("%d%d",&data[i].x,&data[i].y);
            64         sort(data,data+l,cmp);
            65         memset(seg,0,sizeof(seg));
            66         long long ans=0;
            67         for(int i=0;i<l;++i)
            68         {
            69             add(data[i].y,1);
            70             ans+=sum(m)-sum(data[i].y);
            71         }
            72         printf("Test case %d: %lld\n",k,ans);
            73     }
            74     return 0;
            75 }
            76 

            posted on 2009-07-27 16:00 gong 閱讀(1167) 評論(1)  編輯 收藏 引用

            評論

            # re: TOJ 2553 Japan 2009-07-28 15:18 戴爾電腦

            上看到家十分  回復(fù)  更多評論   


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2025年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(6)

            隨筆檔案

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产91久久综合麻豆自制 | 久久精品国产日本波多野结衣| 性做久久久久久免费观看| 性做久久久久久久久浪潮| 国产69精品久久久久777| 久久激情亚洲精品无码?V| 久久www免费人成看片| 国产成人精品久久一区二区三区av | 国产精品一久久香蕉产线看| 国产精品成人99久久久久 | 亚洲天堂久久精品| 一本色道久久99一综合| 国产精品亚洲美女久久久| 久久亚洲AV成人无码电影| 国产精品免费看久久久香蕉| 99久久无码一区人妻a黑| 伊人热热久久原色播放www| 成人国内精品久久久久影院VR| 久久久久免费看成人影片| 亚洲国产小视频精品久久久三级| 成人免费网站久久久| 久久国产精品一国产精品金尊 | 久久99精品国产自在现线小黄鸭| 久久精品国产精品亚洲下载 | yellow中文字幕久久网| 久久久久免费看成人影片| 欧美激情一区二区久久久| 久久丝袜精品中文字幕| 久久精品成人免费国产片小草| 色综合久久88色综合天天| 国产精品久久久久9999| 久久亚洲国产成人精品性色| 亚洲国产一成人久久精品 | 99国产精品久久| 99精品久久精品| 国产精品青草久久久久婷婷| 亚洲天堂久久精品| 欧美粉嫩小泬久久久久久久 | 亚洲精品成人久久久| 伊人久久大香线蕉AV一区二区| 久久中文字幕人妻熟av女|