|
|
back to boardWA 3 Posted by ib18 5 Sep 2010 21:27 Help me please! What's wrong with my program?? #include <iostream> using namespace std; #define ll unsigned long long ll f(ll* a) { swap(a[4], a[5]); for (int i=1; i<=3; i++) if (a[2*i-1]>a[2*i]) swap(a[2*i-1], a[2*i]); for (int c=1; c<=3; c++) for (int i=1; i<3; i++) if (a[2*i-1]>a[2*i+1]) { swap(a[2*i-1], a[2*i+1]); swap(a[2*i], a[2*i+2]); } return a[6]+10*a[5]+100*a[4]+1000*a[3]+10000*a[2]+100000*a[1]; } ll a[100001][7], sol[800][100010], sum; int main() { ll n, k=0, sum; cin>>n; for (ll i=1; i<=n; i++) { for (int j=1; j<=6; j++) cin>>a[i][j]; sum=f(a[i]); //cout<<"i="<<i<<" "<<sum<<endl; bool f=true; for (ll cnt=1; cnt<=k; cnt++) if (sol[cnt][100009]==sum) { f=false; ll tmp=++sol[cnt][0]; sol[cnt][tmp]=i; break; } if (f) { ++k; sol[k][0]=1; sol[k][1]=i; sol[k][100009]=sum; } } cout<<k<<endl; for (ll i=1; i<=k; i++) { for (ll j=1; j<=sol[i][0]; j++) cout<<sol[i][j]<<" "; cout<<endl; } } |
|
|