|
|
вернуться в форумwhy wa 6 why WA 6, i search two pair, if pair=2, then count++ #include <queue> #include <iostream> #include <set> #include <cstdio> #include <algorithm> #include <string> #include <map> #include <string> #include <stack> #include <sstream> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; char a[10000][6]; void swap(char &a,char &b) { if(a>b) { char c; c=a; a=b; b=c; } } int amx(int a,int b) { if(a>b) { return(a); } else return (b); } int main() { int n; cin>>n; for(int i=0;i<n;i++) { cin>>a[i][0]; cin>>a[i][2]; cin>>a[i][3]; cin>>a[i][1]; cin>>a[i][4]; cin>>a[i][5]; } /* for(int i=0;i<n;i++) { for(int j=0;j<6;j++) cout<<a[i][j]<<" "; cout<<endl; } */
int max1=0; for(int i=0;i<n;i++) { int coutn1=0,count2=0,count3=0; for(int j=0;j<n;j++) { //if(i!=j) { if( (((a[i][0]==a[j][0] && a[i][1]==a[j][1])|| (a[i][0]==a[j][2] && a[i][1]==a[j][3]) || (a[i][0]==a[j][4] && a[i][1]==a[j][5])) && ((a[i][2]==a[j][0] && a[i][3]==a[j][1])|| (a[i][2]==a[j][2] && a[i][3]==a[j][3]) || (a[i][2]==a[j][4] && a[i][3]==a[j][5]) )) || (((a[i][1]==a[j][0] && a[i][0]==a[j][1])|| (a[i][1]==a[j][2] && a[i][0]==a[j][3]) || (a[i][1]==a[j][4] && a[i][0]==a[j][5])) && ((a[i][2]==a[j][0] && a[i][3]==a[j][1])|| (a[i][2]==a[j][2] && a[i][3]==a[j][3]) || (a[i][2]==a[j][4] && a[i][3]==a[j][5]) )) || (((a[i][1]==a[j][0] && a[i][0]==a[j][1])|| (a[i][1]==a[j][2] && a[i][0]==a[j][3]) || (a[i][1]==a[j][4] && a[i][0]==a[j][5])) && ((a[i][3]==a[j][0] && a[i][2]==a[j][1])|| (a[i][3]==a[j][2] && a[i][2]==a[j][3]) || (a[i][3]==a[j][4] && a[i][2]==a[j][5]) )) || (((a[i][0]==a[j][0] && a[i][1]==a[j][1])|| (a[i][0]==a[j][2] && a[i][1]==a[j][3]) || (a[i][0]==a[j][4] && a[i][1]==a[j][5])) && ((a[i][3]==a[j][0] && a[i][2]==a[j][1])|| (a[i][3]==a[j][2] && a[i][2]==a[j][3]) || (a[i][3]==a[j][4] && a[i][2]==a[j][5]) )) ) { coutn1++; } if( (((a[i][0]==a[j][0] && a[i][1]==a[j][1])|| (a[i][0]==a[j][2] && a[i][1]==a[j][3]) || (a[i][0]==a[j][4] && a[i][1]==a[j][5])) && ((a[i][4]==a[j][0] && a[i][5]==a[j][1])|| (a[i][4]==a[j][2] && a[i][5]==a[j][3]) || (a[i][4]==a[j][4] && a[i][5]==a[j][5]) )) || (((a[i][1]==a[j][0] && a[i][0]==a[j][1])|| (a[i][1]==a[j][2] && a[i][0]==a[j][3]) || (a[i][1]==a[j][4] && a[i][0]==a[j][5])) && ((a[i][4]==a[j][0] && a[i][5]==a[j][1])|| (a[i][4]==a[j][2] && a[i][5]==a[j][3]) || (a[i][4]==a[j][4] && a[i][5]==a[j][5]) )) || (((a[i][0]==a[j][0] && a[i][1]==a[j][1])|| (a[i][0]==a[j][2] && a[i][1]==a[j][3]) || (a[i][0]==a[j][4] && a[i][1]==a[j][5])) && ((a[i][5]==a[j][0] && a[i][4]==a[j][1])|| (a[i][5]==a[j][2] && a[i][4]==a[j][3]) || (a[i][5]==a[j][4] && a[i][4]==a[j][5]) )) || (((a[i][1]==a[j][0] && a[i][0]==a[j][1])|| (a[i][1]==a[j][2] && a[i][0]==a[j][3]) || (a[i][1]==a[j][4] && a[i][0]==a[j][5])) && ((a[i][5]==a[j][0] && a[i][4]==a[j][1])|| (a[i][5]==a[j][2] && a[i][4]==a[j][3]) || (a[i][5]==a[j][4] && a[i][4]==a[j][5]) )) ) { count2++; } if( (( (a[i][2]==a[j][0] && a[i][3]==a[j][1])|| (a[i][2]==a[j][2] && a[i][3]==a[j][3]) || (a[i][2]==a[j][4] && a[i][3]==a[j][5])) && ((a[i][4]==a[j][0] && a[i][5]==a[j][1])|| (a[i][4]==a[j][2] && a[i][5]==a[j][3]) || (a[i][4]==a[j][4] && a[i][5]==a[j][5]) )) || (((a[i][3]==a[j][0] && a[i][2]==a[j][1])|| (a[i][3]==a[j][2] && a[i][2]==a[j][3]) || (a[i][3]==a[j][4] && a[i][2]==a[j][5])) && ((a[i][4]==a[j][0] && a[i][5]==a[j][1])|| (a[i][4]==a[j][2] && a[i][5]==a[j][3]) || (a[i][4]==a[j][4] && a[i][5]==a[j][5]) )) || (((a[i][2]==a[j][0] && a[i][3]==a[j][1])|| (a[i][2]==a[j][2] && a[i][3]==a[j][3]) || (a[i][2]==a[j][4] && a[i][3]==a[j][5])) && ((a[i][5]==a[j][0] && a[i][4]==a[j][1])|| (a[i][5]==a[j][2] && a[i][4]==a[j][3]) || (a[i][5]==a[j][4] && a[i][4]==a[j][5]) )) || (((a[i][3]==a[j][0] && a[i][2]==a[j][1])|| (a[i][3]==a[j][2] && a[i][2]==a[j][3]) || (a[i][3]==a[j][4] && a[i][2]==a[j][5])) && ((a[i][5]==a[j][0] && a[i][4]==a[j][1])|| (a[i][5]==a[j][2] && a[i][4]==a[j][3]) || (a[i][5]==a[j][4] && a[i][4]==a[j][5]) )) ) { count3++; }
} } max1=amx(amx(coutn1,count2),(max1,count3)); } cout<<max1;
return 0; } Edited by author 03.10.2012 09:29 |
|
|