Submission #406065

#TimeUsernameProblemLanguageResultExecution timeMemory
406065Waratpp123Combo (IOI18_combo)C++14
5 / 100
2 ms292 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string ans,p; char a[4]; string guess_sequence(int N) { int c1=press("AB"),c; int c2=press("AX"); char f; if(c1==0&&c2==0){ f='Y'; a[0]='Y'; a[1]='A'; a[2]='B'; a[3]='X'; } if(c1==0&&c2>=1){ f='X'; a[0]='X'; a[1]='A'; a[2]='B'; a[3]='Y'; } if(c1>=1&&c2==0){ f='B'; a[0]='B'; a[1]='A'; a[2]='Y'; a[3]='X'; } if(c1>=1&&c2>=1){ f='A'; a[0]='A'; a[1]='Y'; a[2]='B'; a[3]='X'; } ans=a[0]; for (int i = 1; i <= N-2; ++i) { p.clear(); p+=ans; p+=a[1]; p+=a[1]; p+=ans; p+=a[1]; p+=a[2]; p+=ans; p+=a[1]; p+=a[3]; p+=ans; p+=a[2]; c=press(p); if(c==i) ans.push_back(a[3]); if(c==i+1) ans.push_back(a[2]); if(c==i+2) ans.push_back(a[1]); } p.clear(); p=ans+a[1]; c=press(p); if(c==N) return p; p.clear(); p=ans+a[2]; c=press(p); if(c==N) return p; p.clear(); p=ans+a[3]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:10: warning: variable 'f' set but not used [-Wunused-but-set-variable]
    9 |     char f;
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...