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

隨筆 - 87  文章 - 279  trackbacks - 0
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 221460
  • 排名 - 118

最新評論

閱讀排行榜

評論排行榜

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) 評論(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>
            亚洲精选久久| 亚洲永久字幕| 六月丁香综合| 久久漫画官网| 亚洲人成在线影院| 亚洲精品久久久久久久久久久久久 | 亚洲国产高清在线| 免费在线欧美视频| 母乳一区在线观看| 日韩视频免费观看高清完整版| 91久久综合| 国产精品资源| 久久综合伊人77777蜜臀| 另类天堂视频在线观看| 中文亚洲字幕| 久久不射中文字幕| 亚洲黄色片网站| 99在线热播精品免费99热| 国产精品爽黄69| 免费看的黄色欧美网站| 欧美久久久久免费| 欧美在线免费观看| 免费观看成人www动漫视频| 亚洲无玛一区| 久久精品亚洲一区二区| 99国产精品99久久久久久粉嫩| 99亚洲一区二区| 极品中文字幕一区| 99精品国产在热久久下载| 国产精品综合网站| 最新国产精品拍自在线播放| 国产精品国产三级国产普通话蜜臀| 久久国产精品久久久久久| 免费国产一区二区| 欧美一区永久视频免费观看| 免费日韩成人| 久久久久www| 欧美三日本三级少妇三99| 老色鬼精品视频在线观看播放 | 亚洲精品久久久蜜桃| 国产精品亚洲激情| 亚洲日本成人| 亚洲福利视频二区| 久久av一区二区三区| 亚洲午夜高清视频| 欧美激情在线狂野欧美精品| 久久精品国产免费| 国产精品美女久久久久aⅴ国产馆| 欧美成人精品不卡视频在线观看 | 欧美激情第3页| 国产亚洲视频在线观看| 亚洲精品视频免费在线观看| 在线电影国产精品| 欧美伊久线香蕉线新在线| 亚洲宅男天堂在线观看无病毒| 欧美成人激情视频| 欧美成年人视频| 亚洲国产va精品久久久不卡综合| 亚洲欧美三级在线| 欧美在线观看一区| 国产精品欧美经典| 亚洲一区二区三区免费观看| 一本大道久久a久久精品综合| 美女精品一区| 亚洲第一二三四五区| 亚洲丁香婷深爱综合| 久久av红桃一区二区小说| 久久精品中文| 国产夜色精品一区二区av| 性欧美1819sex性高清| 久久激情一区| 国产一区二区三区免费不卡 | 久久久久久亚洲精品杨幂换脸| 欧美影院一区| 国产日韩一区欧美| 久久国产99| 免费成人高清| 亚洲精品字幕| 欧美视频国产精品| 亚洲一区免费| 毛片一区二区三区| 亚洲精品国产精品国自产在线| 欧美国产精品久久| 妖精视频成人观看www| 亚洲性线免费观看视频成熟| 国产精品久久综合| 欧美一二三视频| 欧美成人69av| 亚洲调教视频在线观看| 国产乱人伦精品一区二区| 久久精品国产96久久久香蕉| 农夫在线精品视频免费观看| 亚洲精选一区| 国产精品一级| 另类激情亚洲| 在线一区二区日韩| 久久久伊人欧美| 亚洲伦理在线免费看| 国产精品日韩精品欧美在线| 久久久精品性| 一本久道久久久| 狼人天天伊人久久| 亚洲婷婷在线| 在线观看一区| 国产精品每日更新| 欧美成人69av| 欧美亚洲视频一区二区| 亚洲高清资源| 久久久久国产精品人| 99精品视频免费全部在线| 国产在线不卡视频| 欧美视频专区一二在线观看| 久久久久成人精品| 亚洲一区二区三区三| 欧美国产激情| 久久久久国产精品一区三寸| 亚洲免费成人av| 伊人精品久久久久7777| 国产精品久线观看视频| 欧美刺激性大交免费视频| 午夜视频在线观看一区二区三区| 亚洲电影免费观看高清完整版在线观看 | 久久青青草原一区二区| 亚洲深爱激情| 亚洲乱码一区二区| 在线观看日韩av| 国产亚洲一区二区在线观看| 欧美三级日韩三级国产三级| 老司机aⅴ在线精品导航| 亚洲欧美日韩一区二区三区在线| 日韩视频免费观看高清在线视频 | 亚洲精品乱码久久久久久日本蜜臀 | 午夜精品久久久久久久男人的天堂 | 亚洲激情社区| 国外成人在线视频网站| 国产精品免费一区二区三区在线观看 | 亚洲第一久久影院| 久久亚洲私人国产精品va| 激情成人亚洲| 国产欧美日韩激情| 国产精品久久久久999| 欧美日韩福利| 欧美日韩中文字幕在线视频| 欧美激情中文字幕乱码免费| 久久夜色精品国产噜噜av| 欧美在线视频一区| 欧美一区精品| 久久精品女人| 久久免费视频这里只有精品| 欧美专区一区二区三区| 欧美一级理论性理论a| 欧美亚洲在线播放| 欧美影院久久久| 久久九九全国免费精品观看| 久久精品视频免费观看| 久久久午夜视频| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久久久在线| 欧美国产激情| 欧美视频专区一二在线观看| 国产精品久久久久久久浪潮网站| 国产精品第十页| 国产一区二区三区四区hd| 久久人人精品| 欧美激情第1页| 日韩午夜在线观看视频| 亚洲乱亚洲高清| 亚洲一区欧美| 欧美主播一区二区三区美女 久久精品人 | 亚洲欧美偷拍卡通变态| 欧美夜福利tv在线| 乱码第一页成人| 欧美日韩伊人| 国产一区二区精品久久99| 在线免费观看视频一区| 日韩视频在线免费观看| 亚洲欧美一区二区激情| 久久久蜜臀国产一区二区| 亚洲高清不卡av| 在线一区二区视频| 久久久91精品| 欧美日本在线播放| 国产午夜精品一区二区三区欧美 | 久久精品日韩| 亚洲第一天堂av| 亚洲欧美电影院| 欧美福利影院| 国产欧美激情| 一本色道久久综合亚洲精品小说| 欧美一区二区三区精品| 欧美大尺度在线观看| 亚洲欧美国产另类| 欧美绝品在线观看成人午夜影视| 国产欧美日韩视频| 在线视频免费在线观看一区二区| 久久精品91久久香蕉加勒比| 亚洲国产日韩欧美一区二区三区| 午夜精品国产更新| 欧美日韩免费在线观看| 亚洲国产天堂久久国产91|