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

poj2585

Window Pains

Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1090 Accepted: 540

Description

Boudreaux likes to multitask, especially when it comes to using his computer. Never satisfied with just running one application at a time, he usually runs nine applications, each in its own window. Due to limited screen real estate, he overlaps these windows and brings whatever window he currently needs to work with to the foreground. If his screen were a 4 x 4 grid of squares, each of Boudreaux's windows would be represented by the following 2 x 2 windows:
1 1 . .
1 1 . .
. . . .
. . . .
. 2 2 .
. 2 2 .
. . . .
. . . .
. . 3 3
. . 3 3
. . . .
. . . .
. . . .
4 4 . .
4 4 . .
. . . .
. . . .
. 5 5 .
. 5 5 .
. . . .
. . . .
. . 6 6
. . 6 6
. . . .
. . . .
. . . .
7 7 . .
7 7 . .
. . . .
. . . .
. 8 8 .
. 8 8 .
. . . .
. . . .
. . 9 9
. . 9 9
When Boudreaux brings a window to the foreground, all of its squares come to the top, overlapping any squares it shares with other windows. For example, if window 1and then window 2 were brought to the foreground, the resulting representation would be:
1 2 2 ?
1 2 2 ?
? ? ? ?
? ? ? ?
If window 4 were then brought to the foreground:
1 2 2 ?
4 4 2 ?
4 4 ? ?
? ? ? ?
. . . and so on . . .
Unfortunately, Boudreaux's computer is very unreliable and crashes often. He could easily tell if a crash occurred by looking at the windows and seeing a graphical representation that should not occur if windows were being brought to the foreground correctly. And this is where you come in . . .

Input

Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.

A single data set has 3 components:
  1. Start line - A single line:
    START

  2. Screen Shot - Four lines that represent the current graphical representation of the windows on Boudreaux's screen. Each position in this 4 x 4 matrix will represent the current piece of window showing in each square. To make input easier, the list of numbers on each line will be delimited by a single space.
  3. End line - A single line:
    END

After the last data set, there will be a single line:
ENDOFINPUT

Note that each piece of visible window will appear only in screen areas where the window could appear when brought to the front. For instance, a 1 can only appear in the top left quadrant.

Output

For each data set, there will be exactly one line of output. If there exists a sequence of bringing windows to the foreground that would result in the graphical representation of the windows on Boudreaux's screen, the output will be a single line with the statement:

THESE WINDOWS ARE CLEAN

Otherwise, the output will be a single line with the statement:
THESE WINDOWS ARE BROKEN

Sample Input

START
1 2 3 3
4 5 6 6
7 8 9 9
7 8 9 9
END
START
1 1 3 3
4 1 3 3
7 7 9 9
7 7 9 9
END
ENDOFINPUT

Sample Output

THESE WINDOWS ARE CLEAN
THESE WINDOWS ARE BROKEN

圖論的好題
把模型建為網(wǎng)絡(luò),然后判斷是否為AOV網(wǎng)
如何構(gòu)圖
預(yù)處理要先計(jì)算出4*4格的位置可能填放的窗口
讀取快照后,對(duì)每一點(diǎn)處理如下
該點(diǎn)當(dāng)前的窗口為k,對(duì)該點(diǎn)可能出現(xiàn)窗口i,標(biāo)記g[k][i]有邊
正常的話,不會(huì)出現(xiàn)環(huán)
這里判斷AOV網(wǎng)用點(diǎn)的入度計(jì)算
如果存在超過未刪除的點(diǎn)的入度全部大于0,說明存在環(huán)
#include<algorithm>
#include
<iostream>
#include
<cstring>
#include
<string>
#include
<cstdio>
using namespace std;
string cover[4][4];
bool exist[10];//第i個(gè)窗口是否在快照中出現(xiàn)
int id[10];//入度
bool g[10][10];
int t;//頂點(diǎn)數(shù)
int n=4;
int a[4][4];
void getweizhi()
{
    
int i,j,k;
    
for(i=0;i<n;i++)
    
{
        
for(j=0;j<n;j++)
            cover[i][j].erase();
    }

    
for(k=1;k<=9;k++)
    
{
        i
=(k-1)/3;
        j
=(k-1)%3;
        cover[i][j]
+=char(k+'0');
        cover[i][j
+1]+=char(k+'0');
        cover[i
+1][j]+=char(k+'0');
        cover[i
+1][j+1]+=char(k+'0');
    }

}

void init()
{
    
int i,j,k;
    memset(g,
0,sizeof(g));
    memset(exist,
false,sizeof(exist));
    memset(id,
0,sizeof(id));
    t
=0;
    
for(i=0;i<4;i++)
    
{
        
for(j=0;j<4;j++)
        
{
            cin
>>k;
            a[i][j]
=k;
            
if (!exist[k])
            
{
                t
++;
                exist[k]
=true;
            }

        }

    }

}

void build()
{
    
int i,j,p;
    
for(i=0;i<n;i++)
    
for(j=0;j<n;j++)
    
{
        
for(p=0;p<=cover[i][j].length()-1;p++)
            
if (cover[i][j][p]-'0'!=a[i][j]&&!(g[a[i][j]][cover[i][j][p]-'0']))
            
{
                g[a[i][j]][cover[i][j][p]
-'0']=true;
                id[cover[i][j][p]
-'0']++;
            }

    }

}

bool check()
{
    
int i,j,k;
    
for(k=0;k<t;k++)
    
{
        i
=1;
        
while(!exist[i]||(i<=9&&id[i]>0)) i++;
        
if (i>9)//剩余的點(diǎn)中每個(gè)點(diǎn)入度都超過0
        {
            
return false;
        }

        exist[i]
=false;
        
for(j=1;j<=9;j++)
            
if (exist[j]&&g[i][j]) id[j]--;
    }

    
return true;
}

int main()
{
    
string tmp;
    getweizhi();
    
while(cin>>tmp)
    
{
        
if (tmp=="ENDOFINPUT")
        
{
            
break;
        }

        init();
        build();
        
if (check())
            cout
<<"THESE WINDOWS ARE CLEAN"<<endl;
        
else
            cout
<<"THESE WINDOWS ARE BROKEN"<<endl;
        cin
>>tmp;
    }

    
return 0;
}

posted on 2012-04-02 22:56 jh818012 閱讀(144) 評(píng)論(0)  編輯 收藏 引用


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


<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

留言簿

文章檔案(85)

搜索

最新評(píng)論

  • 1.?re: poj1426
  • 我嚓,,輝哥,,居然搜到你的題解了
  • --season
  • 2.?re: poj3083
  • @王私江
    (8+i)&3 相當(dāng)于是 取余3的意思 因?yàn)?3 的 二進(jìn)制是 000011 和(8+i)
  • --游客
  • 3.?re: poj3414[未登錄]
  • @王私江
    0ms
  • --jh818012
  • 4.?re: poj3414
  • 200+行,跑了多少ms呢?我的130+行哦,你菜啦,哈哈。
  • --王私江
  • 5.?re: poj1426
  • 評(píng)論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
  • --王私江
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲福利视频二区| 国产精品久久久久国产a级| 久久亚洲精品中文字幕冲田杏梨 | 久久影音先锋| 亚洲综合好骚| 国产综合亚洲精品一区二| 香蕉乱码成人久久天堂爱免费| 99re6这里只有精品| 欧美精品日韩一区| 欧美在线观看你懂的| 国产精品男人爽免费视频1| 亚洲欧美变态国产另类| 性做久久久久久久久| 国产日韩在线看片| 六月天综合网| 久久一区中文字幕| 欧美三级第一页| 午夜视频一区| 老司机成人网| 亚洲在线中文字幕| 久久久中精品2020中文| 亚洲国产一区视频| 一区二区三区免费观看| 国产视频在线观看一区| 欧美一级久久久久久久大片| 久久久久se| 亚欧成人精品| 欧美二区视频| 久久综合影视| 国产欧美精品一区二区三区介绍| 蜜臀91精品一区二区三区| 国产精品乱码久久久久久| 亚洲第一区色| 欧美伊人久久大香线蕉综合69| 亚洲精选久久| 欧美精品18+| 欧美黄色影院| 国产亚洲激情| 亚洲欧美综合一区| 亚洲在线播放| 欧美成人午夜激情视频| 久久亚洲视频| 欧美极品影院| 欧美成人有码| 欧美精品在线极品| 欧美在线亚洲综合一区| 亚洲毛片在线观看| 性18欧美另类| 一区二区三区高清| 欧美国产日韩亚洲一区| 亚洲伊人久久综合| 欧美三级在线| 亚洲美女视频网| 亚洲美女性视频| 一区二区三区视频在线| 欧美ed2k| 亚洲精品乱码久久久久久蜜桃91 | 亚洲免费观看高清在线观看| 国产一区二区看久久| 亚洲主播在线观看| 日韩视频第一页| 国产精品一级| 久久国产精品99精品国产| 先锋影音久久久| 国产精品五月天| 欧美影院久久久| 亚洲大黄网站| 亚洲午夜免费福利视频| 国产精品家庭影院| 久久久噜噜噜久久狠狠50岁| 韩日午夜在线资源一区二区| 欧美激情视频在线免费观看 欧美视频免费一 | 久久精品一区| 在线观看亚洲视频| 欧美激情无毛| 久久亚洲影音av资源网| 亚洲人成人一区二区三区| 牛夜精品久久久久久久99黑人| 亚洲日韩中文字幕在线播放| 午夜国产精品视频| 亚洲欧洲在线视频| 国产一区二区精品丝袜| av成人天堂| 今天的高清视频免费播放成人 | 夜夜嗨av色一区二区不卡| 欧美一级淫片播放口| 日韩午夜免费视频| 伊人伊人伊人久久| 国产精品久在线观看| 日韩一级不卡| 亚洲影视在线播放| 一区二区三区成人精品| 亚洲破处大片| 亚洲精品国久久99热| 亚洲经典在线| 亚洲国产一区二区精品专区| 亚洲欧美日韩中文视频| 欧美日韩高清在线| 免费一区二区三区| 久久不射中文字幕| 久久婷婷蜜乳一本欲蜜臀| 美女国内精品自产拍在线播放| 久久精品一区二区国产| 久久久久久久国产| 欧美成人高清| 欧美日韩一区二区三区视频| 欧美视频专区一二在线观看| 欧美午夜一区二区| 国产片一区二区| 在线观看视频免费一区二区三区| 欲色影视综合吧| 国产一区二区中文| 一区二区三区|亚洲午夜| 亚洲综合视频一区| 久久久亚洲精品一区二区三区| 麻豆av一区二区三区| 欧美日韩免费看| 亚洲国产乱码最新视频| 一区二区三区免费网站| 久久国产高清| 日韩亚洲欧美成人| 久久夜色精品国产噜噜av| 国产精品成人一区二区三区夜夜夜| 国产亚洲欧美日韩在线一区| 一本色道久久综合亚洲精品不 | 久久免费黄色| 久久激情网站| 欧美福利视频| 一本久久精品一区二区| 欧美劲爆第一页| 亚洲国产成人在线| 久久午夜精品| 欧美一区2区三区4区公司二百| 欧美日韩免费看| 一区二区三区国产在线| 欧美国产免费| 欧美成人午夜| 国产午夜精品久久久| 欧美国产日韩a欧美在线观看| 久久大逼视频| 伊人春色精品| 欧美国产一区二区在线观看| 久久综合久久88| 亚洲美女视频在线观看| 亚洲国产成人精品女人久久久 | 老司机一区二区| 亚洲精品一区二区三区蜜桃久| 欧美高清在线一区二区| 欧美精品免费在线| 亚洲欧美国产日韩中文字幕| 亚洲中午字幕| 亚洲精品日韩一| 亚洲精品久久久久久久久| 亚洲精品国产拍免费91在线| 欧美日韩久久不卡| 欧美中文字幕在线| 亚洲深夜福利网站| 99国产一区| av成人动漫| 久久九九免费视频| 欧美亚洲综合久久| 亚洲精品久久久久久下一站| 亚洲深夜av| 亚洲国产精品一区制服丝袜 | 欧美在线视频免费| 久久全国免费视频| 99热这里只有精品8| 午夜精品一区二区三区在线| 一区二区三区成人| 久久大综合网| 先锋影院在线亚洲| 欧美国产日韩一区二区在线观看| 久久久精品午夜少妇| 国产精品电影观看| 欧美激情第一页xxx| 国产视频观看一区| 亚洲欧美色一区| 亚洲淫片在线视频| 欧美母乳在线| 夜夜嗨av色一区二区不卡| 日韩写真视频在线观看| 久久国产免费看| 亚洲精选在线| 一本大道久久a久久综合婷婷| 麻豆精品精华液| 亚洲激情黄色| 亚洲丝袜av一区| 国产精品久久久久久妇女6080| 亚洲女人天堂av| 亚洲国产精品热久久| 欧美成人午夜激情在线| 亚洲一区二区黄| 鲁大师成人一区二区三区| 亚洲经典视频在线观看| 国产精品萝li| 欧美 日韩 国产在线| 91久久综合| 国产精品视频yy9299一区| 亚洲永久视频| 99精品免费|