Hi, 

In Round 1C for Power Arrangers problem, Below is my solution. But, It gave 
Wrong Answer. I could not find any fault. Since, this is interactive problem, I 
could not test in IDE. Please help.

#include <bits/stdc++.h>

using namespace std;

int main() {
    //ios_base::sync_with_stdio(0); 
    //cin.tie(NULL); 
    //cout.tie(NULL);
  
  int tt, n;
  
  cin>>tt>>n;
  for (int qq = 1LL; qq <= tt; qq++) {
   
   char ram[130][7];
   memset(ram, 'Z', sizeof ram); 
   
   int rA, rB,rC,rD,rE;
   char r1,r2,r3,r4,r5;
   char ch;
   
   rA=rB=rC=rD=rE=0;
   
   for(int i=1;i<=595;i=i+5)
   {
           //cout<<i<<endl;
           printf("%d\n",i);
           fflush(stdout);
           //cin>>ch;
           scanf("%c",&ch);
           ram[(i+5)/5][1]=ch;
           
           if(ch == 'A') rA++;
           else if(ch == 'B') rB++;
           else if(ch == 'C') rC++;
           else if(ch == 'D') rD++;
           else if(ch == 'E') rE++;
           
   }
   
   if(rA==23)
   r1 ='A';
   else if (rB==23)
   r1='B';
   else if (rC==23)
   r1='C';
   else if (rD==23)
   r1='D';
   else if (rE==23)
   r1='E';
   
   rA=rB=rC=rD=rE=0;
   
   for(int i=1;i<=119;i++)
   {
           if(ram[i][1]==r1){
           //cout<<(i-1)*5+2;
           printf("%d\n",(i-1)*5+2);
           fflush(stdout);
           //cin>>ch;
           scanf("%c",&ch);
           ram[i][2]=ch;
           
           if(ch == 'A') rA++;
           else if(ch == 'B') rB++;
           else if(ch == 'C') rC++;
           else if(ch == 'D') rD++;
           else if(ch=='E') rE++;
   }
   }
   
   if(rA==5)
   r2 ='A';
   else if (rB==5)
   r2='B';
   else if (rC==5)
   r2='C';
   else if (rD==5)
   r2='D';
   else if (rE==5)
   r2='E';
   
   rA=rB=rC=rD=rE=0;
   for(int i=1;i<=119;i++)
   {
           if(ram[i][1]==r1 && ram[i][2]==r2){
           //cout<<(i-1)*5+3;
           //cin>>ch;
           printf("%d\n",(i-1)*5+3);
           fflush(stdout);
           
          
           scanf("%c",&ch);
           ram[i][3]=ch;
           
           if(ch == 'A') rA++;
           else if(ch == 'B') rB++;
           else if(ch == 'C') rC++;
           else if(ch == 'D') rD++;
           else if(ch == 'E')rE++;
   }}
   
   if(rA==1)
   r3 ='A';
   else if (rB==1)
   r3='B';
   else if (rC==1)
   r3='C';
   else if (rD==1)
   r3='D';
   else if (rE==1)
   r3='E';
   
   
   rA=rB=rC=rD=rE=0;
   for(int i=1;i<=119;i++)
   {
           if(ram[i][1]==r1 && ram[i][2]==r2 && ram[i][3]==r3){
           //cout<<(i-1)*5+4;
           //cin>>ch;
           printf("%d\n",(i-1)*5+4);
           fflush(stdout);
           
           scanf("%c",&ch);
           ram[i][4]=ch;
           
           if(ch == 'A') rA++;
           else if(ch == 'B') rB++;
           else if(ch == 'C') rC++;
           else if(ch == 'D') rD++;
           else if(ch == 'E') rE++;
   }
}
   
   if(rA==1)
   r5 ='A';
   else if (rB==1)
   r5='B';
   else if (rC==1)
   r5='C';
   else if (rD==1)
   r5='D';
   else if (rE==1)
   r5='E';
   
   int ram1[5] ={0,0,0,0,0};
   
   ram1[r1-'A']=1;
   ram1[r2-'A']=1;
   ram1[r3-'A']=1;
   ram1[r5-'A']=1;
   for(int k=0;k<=4;k++)
   if(ram1[k]==0)
   r4='A'+k;
   
   char str[5]={r1,r2,r3,r4,r5};
   //cout<<str<<endl;
   printf("%s\n", str);
   fflush(stdout);
   
   char verdict;
    
    //cin>>verdict;
    scanf("%c",&verdict);
    if(verdict != 'Y')
        exit(0);
  }
  return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/3ead7ac7-64b2-4054-a898-3b5cf9fdb83b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to