Submission #78797

#TimeUsernameProblemLanguageResultExecution timeMemory
78797patcasraresCombo (IOI18_combo)C++14
5 / 100
2 ms256 KiB
#include<iostream> #include "combo.h" using namespace std; int press2(string s,int n) { //cout<<s.size()<<' '<<4*n<<'\n'; if(s.size()>4*n) while(1){} return press(s); } string guess_sequence(int n) { int r,poz=0,cnt=-1; char a[3],cand[4]={'A','B','X','Y'}; string q,rez; q="AB"; r=press2(q,n); if(r) poz=0; else poz=2; q=cand[poz]; r=press2(q,n); if(r==0) poz++; for(int i=0;i<4;i++) if(i!=poz) { cnt++; a[cnt]=cand[i]; } rez=cand[poz]; cnt=1; poz=2; for(int i=2;i<n;i++) { q=rez+a[0]+rez+a[1]+a[0]+rez+a[1]+a[1]+rez+a[1]+a[2]; r=press2(q,n); if(r==i-1) { rez.push_back(a[2]); continue; } else if(r==i) { rez.push_back(a[0]); continue; } else rez.push_back(a[1]); } q=rez+a[0]+rez+a[1]; r=press2(q,n); if(r==n) { q=rez+a[0]; r=press2(q,n); if(r==n) rez.push_back(a[0]); else rez.push_back(a[1]); } else rez.push_back(a[2]); return rez; }

Compilation message (stderr)

combo.cpp: In function 'int press2(std::string, int)':
combo.cpp:7:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |     if(s.size()>4*n)
      |        ~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...