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

            聚精會神搞建設 一心一意謀發展
            posts - 190, comments - 17, trackbacks - 0, articles - 0
               :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            Section 3.1- Shaping Regions

            Posted on 2009-04-27 10:53 superman 閱讀(122) 評論(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 
            国产情侣久久久久aⅴ免费| 精品无码久久久久久久动漫| 久久综合色区| 亚洲欧美日韩精品久久亚洲区 | 狠狠精品干练久久久无码中文字幕| 97r久久精品国产99国产精| 久久WWW免费人成—看片| 日本五月天婷久久网站| 欧美伊香蕉久久综合类网站| A级毛片无码久久精品免费| 精品久久久久久无码中文野结衣| 久久婷婷五月综合97色直播| 久久综合久久综合久久综合| 成人综合久久精品色婷婷| 久久99精品国产99久久| 久久无码AV一区二区三区| 亚洲狠狠综合久久| 无码AV波多野结衣久久| 武侠古典久久婷婷狼人伊人| 久久本道伊人久久| 亚洲精品无码久久一线| 亚洲人成无码www久久久| 亚洲国产精品久久| 久久精品亚洲精品国产色婷| 久久精品人人做人人爽电影| 久久久久亚洲AV无码去区首| 色偷偷888欧美精品久久久| 久久w5ww成w人免费| 亚洲中文字幕久久精品无码APP| 久久伊人亚洲AV无码网站| 97久久精品国产精品青草| 久久久免费精品re6| 一个色综合久久| 偷偷做久久久久网站| 婷婷国产天堂久久综合五月| 久久久久一本毛久久久| 国产精品成人久久久久久久| 97超级碰碰碰碰久久久久| 精品国产91久久久久久久a| 国内精品久久久久久久影视麻豆| 亚洲国产精品久久久久|