标签:count ice define show osi content arc fir des
http://acm.hdu.edu.cn/showproblem.php?pid=5983
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2852 Accepted Submission(s): 1066
+ - + - + - + - + - + - +
| q | r | a | b | u | v |
+ - + - + - + - + - + - +
| s | t | c | d | w | x |
+ - + - + - + - + - + - +
| e | f |
+ - + - +
| g | h |
+ - + - +
| i | j |
+ - + - +
| k | l |
+ - + - +
| m | n |
+ - + - +
| o | p |
+ - + - +
纯模拟= =,训练的时候脑抽没写出来
1 #include<iostream> 2 #include<cstring> 3 #include<string> 4 #include<cmath> 5 #include<cstdio> 6 #include<algorithm> 7 #include<vector> 8 #define maxn 200005 9 #define lson l,mid,rt<<1 10 #define rson mid+1,r,rt<<1|1 11 using namespace std; 12 13 int map[7][5]; 14 15 bool Check(){ 16 int flag; 17 for(int i=1;i<=6;i++){ 18 flag=map[i][1]; 19 for(int j=2;j<=4;j++){ 20 if(flag!=map[i][j]){ 21 return false; 22 } 23 } 24 } 25 return true; 26 } 27 28 int _init_[7][5]; 29 30 void init(){ 31 for(int i=1;i<=6;i++){ 32 for(int j=1;j<=4;j++){ 33 map[i][j]=_init_[i][j]; 34 } 35 } 36 } 37 38 int main(){ 39 40 int t; 41 cin>>t; 42 while(t--){ 43 for(int i=1;i<=6;i++){ 44 for(int j=1;j<=4;j++){ 45 cin>>_init_[i][j]; 46 } 47 } 48 int tmp1,tmp2; 49 init(); 50 if(Check()){ 51 cout<<"YES"<<endl; 52 continue; 53 } 54 //1 55 init(); 56 tmp1=map[1][1],tmp2=map[1][3]; 57 map[1][1]=map[2][1],map[1][3]=map[2][3]; 58 map[2][1]=map[3][1],map[2][3]=map[3][3]; 59 map[3][1]=map[4][1],map[3][3]=map[4][3]; 60 map[4][1]=tmp1,map[4][3]=tmp2; 61 if(Check()){ 62 cout<<"YES"<<endl; 63 continue; 64 } 65 init(); 66 tmp1=map[1][1],tmp2=map[1][3]; 67 map[1][1]=map[4][1],map[1][3]=map[4][3]; 68 map[4][1]=map[3][1],map[4][3]=map[3][3]; 69 map[3][1]=map[2][1],map[3][3]=map[2][3]; 70 map[2][1]=tmp1,map[2][3]=tmp2; 71 if(Check()){ 72 cout<<"YES"<<endl; 73 continue; 74 } 75 //2 76 init(); 77 tmp1=map[2][1],tmp2=map[2][2]; 78 map[2][1]=map[6][3],map[2][2]=map[6][1]; 79 map[6][3]=map[4][4],map[6][1]=map[4][3]; 80 map[4][4]=map[5][2],map[4][3]=map[5][4]; 81 map[5][2]=tmp1,map[5][4]=tmp2; 82 if(Check()){ 83 cout<<"YES"<<endl; 84 continue; 85 } 86 init(); 87 tmp1=map[5][2],tmp2=map[5][4]; 88 map[5][2]=map[4][4],map[5][4]=map[4][3]; 89 map[4][4]=map[6][3],map[4][3]=map[6][1]; 90 map[6][3]=map[2][1],map[6][1]=map[2][2]; 91 map[2][1]=tmp1,map[2][2]=tmp2; 92 if(Check()){ 93 cout<<"YES"<<endl; 94 continue; 95 } 96 //3 97 init(); 98 tmp1=map[3][1],tmp2=map[3][2]; 99 map[3][1]=map[6][4],map[3][2]=map[6][3]; 100 map[6][4]=map[1][4],map[6][3]=map[1][3]; 101 map[1][4]=map[5][4],map[1][3]=map[5][3]; 102 map[5][4]=tmp1,map[5][3]=tmp2; 103 if(Check()){ 104 cout<<"YES"<<endl; 105 continue; 106 } 107 init(); 108 tmp1=map[5][4],tmp2=map[5][3]; 109 map[5][4]=map[1][4],map[5][3]=map[1][3]; 110 map[1][4]=map[6][4],map[1][3]=map[6][3]; 111 map[6][4]=map[3][1],map[6][3]=map[3][2]; 112 map[3][1]=tmp1,map[3][2]=tmp2; 113 if(Check()){ 114 cout<<"YES"<<endl; 115 continue; 116 } 117 cout<<"NO"<<endl; 118 } 119 120 }
标签:count ice define show osi content arc fir des
原文地址:https://www.cnblogs.com/Fighting-sh/p/9866269.html