Submission #956045

#TimeUsernameProblemLanguageResultExecution timeMemory
956045ASGA_RedSeaCombo (IOI18_combo)C++17
100 / 100
15 ms2032 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; //int press(string s){cout<<"press : ( "<<s.size()<<" , "<<s<<") : ";int r;cin>>r;return r;} string guess_sequence(int n){ string s,c = "ABXY"; int f = 0; int rr = press(string("AB")); if(rr == 1){ if(press(string("A")))s += 'A'; else s += 'B'; } else if(rr == 2)s += 'A'; else{ if(press(string("X")))s += 'X'; else s += 'Y'; } c.erase(find(c.begin(),c.end(),s[0]) - c.begin(),1); for(int i = 1;i < n - 1;i++){ string p = s; p += c[0]; string pp = s;pp += c[1]; for(int j = 0;j < 3;j++){p += pp;p += c[j];} int r = press(p); if(r == i + 1)s += c[0]; else if(r == i + 2)s += c[1]; else s += c[2]; } if(n > 1){ if(press(s + string(1,c[0])) == n)s += c[0]; else if(press(s + string(1,c[1])) == n)s += c[1]; else s += c[2]; } return s; } //int main(){int n;cin>>n;cout<<guess_sequence(n);return 0;}

Compilation message (stderr)

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