青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 87  文章 - 279  trackbacks - 0
<2007年2月>
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊(cè)

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 221655
  • 排名 - 118

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

Bugs Integrated, Inc.
Time Limit:15000MS  Memory Limit:30000K
Total Submit:1180 Accepted:309
Case Time Limit:5000MS

Description
Bugs Integrated, Inc. is a major manufacturer of advanced memory chips. They are launching production of a new six terabyte Q-RAM chip. Each chip consists of six unit squares arranged in a form of a 2*3 rectangle. The way Q-RAM chips are made is such that one takes a rectangular plate of silicon divided into N*M unit squares. Then all squares are tested carefully and the bad ones are marked with a black marker.


Finally, the plate of silicon is cut into memory chips. Each chip consists of 2*3 (or 3*2) unit squares. Of course, no chip can contain any bad (marked) squares. It might not be possible to cut the plate so that every good unit square is a part of some memory chip. The corporation wants to waste as little good squares as possible. Therefore they would like to know how to cut the plate to make the maximum number of chips possible.
Task
You are given the dimensions of several silicon plates and a list of all bad unit squares for each plate. Your task is to write a program that computes for each plate the maximum number of chips that can be cut out of the plate.

 

Input
The first line of the input file consists of a single integer D (1 <= D <= 5), denoting the number of silicon plates. D blocks follow, each describing one silicon plate. The first line of each block contains three integers N (1 <= N <= 150), M (1 <= M <= 10), K (0 <= K <= MN) separated by single spaces. N is the length of the plate, M is its height and K is the number of bad squares in the plate. The following K lines contain a list of bad squares. Each line consists of two integers x and y (1 <= x <= N, 1 <= y <= M) ?coordinates of one bad square (the upper left square has coordinates [1, 1], the bottom right is [N,M]).

Output
For each plate in the input file output a single line containing the maximum number of memory chips that can be cut out of the plate.

Sample Input

2
6 6 5
1 4
4 6
2 2
3 6
6 4
6 5 4
3 3
6 1
6 2
6 4

 

Sample Output

3
4

 

Source
CEOI 2002

CODE:

#include <iostream>
using namespace std;

int g[150][10], blk[10];
int d[4][60000];
int e[11= {1392781243729218765611968359049};
int n, m, kn;
int can1, can2, b[10][60000];
int *l0, *l1, *l2, *l3, *bit0, *bit1, *bit2;

void build() {
    
int i, j, tmp;
    
for (i=0; i<e[10]; i++{
        j 
= 0; tmp = i;
        
while (tmp > 0{
            b[j][i] 
= tmp % 3;
            tmp 
/= 3;
            j
++;
        }

    }

}
 

inline 
int maxt(int a, int b) {
    
return a > b ? a : b;
}


void solve() {
    
int i, j, k, x, y, a1, a2, p, c;
    scanf(
"%d%d%d"&n, &m, &kn);
    memset(g, 
0sizeof(g));
    memset(d, 
0sizeof(d));
    
for (i=0; i<kn; i++{
        scanf(
"%d%d"&x, &y);
        g[x
-1][y-1= 1;
    }

    
for (i=0; i<m; i++) blk[i] = 1 - g[0][i];
    
for (i=1, c=2; i<n; i++{
        
for (j=0; j<m; j++{
            
if (g[i][j]) blk[j] = 0;
            
else blk[j]++;
            c 
= (c+1)%4;
            can1 
= (j>0 && blk[j]>2 && blk[j-1]>2);
            can2 
= (j>1 && blk[j]>1 && blk[j-1]>1 && blk[j-2]>1);
            a1 
= 2*e[j]+2*e[j-1];
            a2 
= e[j]+e[j-1]+e[j-2];
            l0 
= d[c]; l1 = d[(c+3)%4]; l2 = d[(c+2)%4]; l3 = d[(c+1)%4];
            bit0 
= b[j]; 
            
if (j>0) bit1 = b[j-1]; 
            
if (j>1) bit2 = b[j-2];
            
for (p=0; p<e[m]; p++{
                
if (bit0[p]) {
                    l0[p] 
= l1[p-e[j]];
                }
 else {
                    l0[p] 
= l1[p];
                    
if (j>0 && !bit1[p]) {
                        
if (can1) l0[p] = maxt(l0[p],l2[p+a1]+1);
                        
if (can2 && !bit2[p]) l0[p] = maxt(l0[p], l3[p+a2]+1);
                    }

                }

            }

        }

    }

    printf(
"%d\n", d[c][0]);
}


int main() {
    build();
    
int caseTime;
    scanf(
"%d"&caseTime);
    
while (caseTime--{
        solve();
    }

    
return 0;
}


 
posted on 2007-04-18 11:42 閱讀(1800) 評(píng)論(0)  編輯 收藏 引用 所屬分類: ACM題目
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            18成人免费观看视频| 欧美大香线蕉线伊人久久国产精品| 亚洲高清成人| 久久国产毛片| 一本久道久久久| 亚洲风情在线资源站| 国产乱码精品一区二区三区av| 欧美激情女人20p| 久久久噜噜噜久久人人看| 亚洲一区一卡| 日韩视频中午一区| 亚洲动漫精品| 欧美福利小视频| 久久一区亚洲| 久久高清福利视频| 亚洲欧美中文字幕| 亚洲无限av看| 夜夜精品视频一区二区| 亚洲激情另类| 亚洲福利视频一区| 精品av久久707| 国产亚洲精品激情久久| 国产欧美日本在线| 国产精品日韩在线| 国产精品久久久久久久久久免费看 | 奶水喷射视频一区| 欧美一级淫片播放口| 亚洲一区免费网站| 亚洲一区二区免费在线| 一区二区三区视频观看| 99精品视频免费| 日韩系列在线| 一本一道久久综合狠狠老精东影业| 日韩视频不卡| 日韩一区二区免费看| 一区二区三区黄色| 亚洲欧美国产精品桃花| 销魂美女一区二区三区视频在线| 亚洲欧美日韩国产一区二区| 亚洲欧美一区二区三区极速播放| 亚洲摸下面视频| 欧美在线视频网站| 久久亚洲私人国产精品va| 蜜臀久久久99精品久久久久久| 久久综合狠狠| 免费中文日韩| 欧美成人免费在线视频| 久久天天躁夜夜躁狠狠躁2022| 一本大道久久精品懂色aⅴ| 亚洲理论在线| 99精品视频免费| 一区二区三区国产在线观看| 亚洲午夜在线| 一本大道久久a久久精品综合| 一本久久综合| 亚洲影音一区| 欧美一区久久| 久久综合999| 欧美成人中文| 欧美日韩黄色大片| 亚洲影院免费观看| 欧美一区二区| 久久免费精品视频| 免费看黄裸体一级大秀欧美| 免费精品99久久国产综合精品| 免费中文日韩| 欧美日韩亚洲高清一区二区| 国产精品v欧美精品∨日韩| 国产精品久久久久久久午夜| 国产日韩欧美视频| 国产日韩欧美在线播放| 亚洲国产精品第一区二区| 日韩视频免费大全中文字幕| 亚洲神马久久| 欧美专区在线观看| 欧美大片免费观看在线观看网站推荐| 欧美国产日韩一二三区| 99视频在线精品国自产拍免费观看| 一区二区免费在线视频| 一区二区三区精品| 久久嫩草精品久久久精品一| 欧美精品麻豆| 国产精品亚洲一区| 亚洲高清久久网| 亚洲香蕉伊综合在人在线视看| 欧美在线日韩精品| 亚洲第一天堂av| 亚洲一区二区精品在线| 久久综合影音| 欧美午夜精品电影| 激情视频一区| 亚洲婷婷国产精品电影人久久| 久久av一区二区三区| 亚洲福利一区| 亚洲欧美一区二区精品久久久| 蜜臀久久久99精品久久久久久 | 久久久精品国产一区二区三区| 久久久噜噜噜久久狠狠50岁| 亚洲美女电影在线| 久久精品视频导航| 国产精品va在线播放| 在线高清一区| 午夜精品国产更新| 欧美国产免费| 亚洲欧美在线看| 欧美日韩国产色站一区二区三区| 国产精品久久久久久福利一牛影视| 韩国一区电影| 亚洲一区二区黄| 免费久久99精品国产| 亚洲深夜av| 欧美高清在线播放| 国产综合香蕉五月婷在线| 亚洲天堂免费观看| 亚洲高清av| 久久精品国产免费观看| 国产乱码精品一区二区三区五月婷| 亚洲三级视频| 美女诱惑一区| 午夜综合激情| 国产精品v日韩精品| 亚洲三级免费| 欧美多人爱爱视频网站| 久久国产精品网站| 国产亚洲综合精品| 午夜精品一区二区三区电影天堂 | 在线一区二区三区四区五区| 欧美ab在线视频| 激情成人亚洲| 午夜一区二区三区在线观看| av72成人在线| 欧美日韩免费观看一区二区三区| 136国产福利精品导航网址应用 | 久久aⅴ国产紧身牛仔裤| 国产精品一区二区你懂的| 99国产精品久久久久久久久久| 欧美国产乱视频| 裸体女人亚洲精品一区| 曰本成人黄色| 性伦欧美刺激片在线观看| 亚洲欧美日韩第一区| 国产精品无码永久免费888| 亚洲中午字幕| 亚洲一区免费看| 国产九九精品| 久久精品天堂| 欧美一区二区三区免费在线看| 欧美精品三级在线观看| 亚洲一区欧美| 亚洲少妇自拍| 国产精品亚洲人在线观看| 欧美淫片网站| 久久国产加勒比精品无码| 狠狠久久亚洲欧美专区| 久久久xxx| 欧美影院一区| 在线国产精品播放| 亚洲电影网站| 欧美偷拍一区二区| 亚洲欧美视频在线观看| 亚洲欧美在线磁力| 国产精品久久久久久久久搜平片 | 开心色5月久久精品| 狠狠久久婷婷| 日韩网站在线| 国产九九精品| 美女视频网站黄色亚洲| 女人色偷偷aa久久天堂| 一本色道久久综合亚洲精品高清| 夜夜夜久久久| 欧美午夜精品久久久久久久| 久久精品噜噜噜成人av农村| 久久人91精品久久久久久不卡| 亚洲人体偷拍| 亚洲视频狠狠| 激情av一区二区| 亚洲精品视频在线| 国产伦精品一区二区三区在线观看| 一区二区激情| 午夜精品影院| 亚洲国内自拍| 亚洲视频一区二区| 韩国一区二区三区在线观看 | 亚洲综合电影| 亚洲电影免费观看高清完整版在线观看 | 欧美美女福利视频| 久久精品人人| 欧美乱在线观看| 一区二区三区国产精品| 久久久久久久久久久久久久一区 | 亚洲激情一区二区| 国产麻豆日韩欧美久久| 美女视频黄免费的久久| 国产精品私拍pans大尺度在线| 欧美成人dvd在线视频| 欧美午夜理伦三级在线观看| 麻豆精品网站| 国产精品色婷婷久久58| 亚洲高清不卡| 狠狠爱www人成狠狠爱综合网|