题目的意思是说用四种颜色给矩形上色,要求相邻的矩形不能为同一种颜色,每个矩形的边长为奇数。
这个题我想麻烦了,想到了IOI99年发的Picture的那篇论文了,想着先标号,用扫面线什么的,后来去翻了翻那篇论文,题目果然不一样。
我就不讲解了,我也没做出来,放上大牛的链接:http://blog.csdn.net/qq_34374664/article/details/54850964
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
struct node{
int x1,x2;
int y1,y2;
}xin[700000];
int main(){
int n;
while(~scanf("%d",&n)){
for(int i=0;i<n;i++){
scanf("%d%d",&xin[i].x1,&xin[i].y1);
scanf("%*d%*d");
}
cout<<"YES"<<endl;
for(int i=0;i<n;i++){
int x=xin[i].x1;
int y=xin[i].y1;
if(!(x&1)&&!(y&1)){
printf("1\n");
}
else if(!(x&1)&&(y&1)){
printf("2\n");
}
else if((x&1)&&!(y&1)){
printf("3\n");
}
else{
printf("4\n");
}
}
}
return 0;
}