Window Pains
来源:互联网 发布:pr文艺小清新调色数据 编辑:程序博客网 时间:2024/05/27 00:50
3:Window Pains
- 查看
- 提交
- 统计
- 提问
- 总时间限制:
- 1000ms
- 内存限制:
- 65536kB
- 描述
- 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:
11..11...........22..22...........33..33............44..44...........55..55...........66..66............77..77...........88..88...........99..99When 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 thenwindow 2 were brought to the foreground, the resulting representation would be:122?122?????????If window 4 were then brought to the foreground:122?442?44??????. . . 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 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:- Start line - A single line:
START - 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.
- 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. - Start line - A single line:
- 输出
- 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 - 样例输入
START1 2 3 34 5 6 67 8 9 97 8 9 9ENDSTART1 1 3 34 1 3 37 7 9 97 7 9 9ENDENDOFINPUT
- 样例输出
THESE WINDOWS ARE CLEANTHESE WINDOWS ARE BROKEN
- 来源
- South Central USA 2003
#include<iostream>#include<cmath>#include<cstring>#include<algorithm>#include<iomanip>#include<queue>#include<stack>#include<vector>#include<set>#include<map>using namespace std;string s; bool edge[10][10];bool vis[10]={0};vector<int>V[16];int In[10];void Init(){int t=0;for(int i=1;i<=9;++i){V[t].push_back(i);V[t+1].push_back(i);V[t+4].push_back(i);V[t+5].push_back(i);t++;if(i%3==0)t++;}}int main(){Init();while(cin>>s){if(s=="ENDOFINPUT")break;memset(edge,0,sizeof(edge));memset(vis,0,sizeof(vis));memset(In,0,sizeof(In));int a;for(int i=0;i<16;++i){cin>>a;for(int j=0;j<V[i].size();++j){if(a==V[i][j]||edge[a][V[i][j]])continue;In[V[i][j]]++;edge[a][V[i][j]]=true;}}cin>>s;for(int i=1;i<=9;++i){for(int j=1;j<=9;++j){if((!vis[j])&&(In[j]==0)){vis[j]=true;for(int k=1;k<=9;++k){if(edge[j][k]){edge[j][k]=false;In[k]--;}}}}}int i;for(i=1;i<=9;++i){if(!vis[i]){cout<<"THESE WINDOWS ARE BROKEN"<<endl;break;}}if(i==10)cout<<"THESE WINDOWS ARE CLEAN"<<endl;}return 0;}
阅读全文
0 0
- Window Pains
- poj 2585 Window Pains
- POJ2585--Window Pains
- poj2585 Window Pains
- poj2585 Window Pains
- POJ-2585 Window Pains
- poj 2585 Window Pains
- zoj 2193 Window Pains
- POJ2585 Window Pains
- Window Pains-POJ2585
- POJ-2585 Window Pains
- <poj2585>Window Pains
- POJ 2585Window Pains
- 【POJ】[2585]Window Pains
- Window Pains POJ 2585
- poj2585 Window Pains
- POJ2585 Window Pains [拓扑排序]
- POJ 2585 Window Pains【拓扑】
- jsp转发
- Android Tinker热更新Sample_demo接入
- Neo4j CQL -(16)- 合并
- Git分支提交代码到主干上
- 4300: 绝世好题
- Window Pains
- cJSON的简单应用(json对象、数组)
- CSS/JS 实现滑动页面,到一定位置,position 定位设置为fixed,否则用absolute;
- CreateToolhelp32Snapshot枚举进程(转) CreateToolhelp32Snapshot枚举进程 每一个应用程序实例在运行起来后都会在当前系统下产生一个进程,大多数应用程序均拥
- python查看import的目录
- 如何用git将项目代码上传到github
- 演讲稿
- netty4.x FixedChannelPool使用
- Windows10下安装mysql-5.7.18-winx64