• <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>

            superman

            聚精會(huì)神搞建設(shè) 一心一意謀發(fā)展
            posts - 190, comments - 17, trackbacks - 0, articles - 0
               :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            Section 3.1- Shaping Regions

            Posted on 2009-04-27 10:53 superman 閱讀(128) 評論(0)  編輯 收藏 引用 所屬分類: USACO
             1 #include <iostream>
             2 
             3 using namespace std;
             4 
             5 int n, m, t;
             6 int sx[1001], sy[1001], tx[1001], ty[1001], col[1001], cnt[2600];
             7 
             8 int curCol;
             9 void cut(int csx, int csy, int ctx, int cty, int i)
            10 {
            11     while ((i <= t) && (sx[i] >= ctx || tx[i] <= csx || sy[i] >= cty || ty[i] <= csy))
            12         i++;
            13     if (i > t)
            14     {
            15         cnt[curCol] += (ctx - csx) * (cty - csy);
            16         return;
            17     }
            18 
            19     if (csx < sx[i])
            20     {
            21         cut(csx, csy, sx[i], cty, i + 1);
            22         csx = sx[i];
            23     }
            24     if (ctx > tx[i])
            25     {
            26         cut(tx[i], csy, ctx, cty, i + 1);
            27         ctx = tx[i];
            28     }
            29     if (csy < sy[i])
            30         cut(csx, csy, ctx, sy[i], i + 1);
            31     if (cty > ty[i])
            32         cut(csx, ty[i], ctx, cty, i + 1);
            33 }
            34 
            35 int main()
            36 {
            37     freopen("rect1.in""r", stdin);
            38     freopen("rect1.out""w", stdout);
            39 
            40     cin >> n >> m >> t;
            41 
            42     sx[0= 0;
            43     sy[0= 0;
            44     tx[0= n;
            45     ty[0= m;
            46     col[0= 1;
            47     for (int i = 1; i <= t; i++)
            48         cin >> sx[i] >> sy[i] >> tx[i] >> ty[i] >> col[i];
            49 
            50     for (int i = t; i >= 0; i--)
            51     {
            52         curCol = col[i];
            53         cut(sx[i], sy[i], tx[i], ty[i], i + 1);
            54     }
            55 
            56     for (int i = 1; i <= 2500; i++)
            57         if (cnt[i])
            58             cout << i << ' ' << cnt[i] << endl;
            59 
            60     return 0;
            61 }
            62 
            99久久人妻无码精品系列| 亚洲精品乱码久久久久久按摩| 国产激情久久久久影院老熟女免费 | 久久精品国产亚洲AV香蕉| 18禁黄久久久AAA片| 久久综合久久综合亚洲| 久久久久亚洲AV片无码下载蜜桃| 中文字幕无码久久人妻| 色综合合久久天天综合绕视看| 国产成人精品久久亚洲高清不卡| 亚洲AV伊人久久青青草原| www.久久热.com| 久久人人爽人人爽人人AV| 久久精品日日躁夜夜躁欧美| 久久久久久国产a免费观看不卡| 亚洲色大成网站www久久九| 2020久久精品国产免费| 久久精品国产第一区二区三区| 久久久久亚洲AV无码专区桃色| 丁香五月网久久综合| 精品精品国产自在久久高清| 久久国产热精品波多野结衣AV| 亚洲一区精品伊人久久伊人 | 久久99精品国产自在现线小黄鸭| 久久免费大片| 99久久精品免费看国产一区二区三区 | 情人伊人久久综合亚洲| 久久精品嫩草影院| 国产精品久久久天天影视香蕉| 久久久久国产一区二区三区| 亚洲欧洲久久久精品| 久久精品国产亚洲AV香蕉| 久久亚洲国产精品一区二区| 久久精品国产72国产精福利| 久久夜色撩人精品国产| 久久亚洲AV成人无码国产| 久久久久九九精品影院| 精品久久久久香蕉网| 欧美精品九九99久久在观看| 大伊人青草狠狠久久| 亚洲AV成人无码久久精品老人|