Submission #340268

#TimeUsernameProblemLanguageResultExecution timeMemory
340268FystyCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s=""; if(n==1) { if(press("A")) return "A"; else if(press("B")) return "B"; else if(press("X")) return "X"; else return "Y"; } int k=press("AB"); if(k) { if(press("AA")) s="A"; else s="B"; } else { if(press("XX")) s="X"; else s="Y"; } if(s=="A") { while(s.size()<n-1) { int t=press(s+"B"+s+"XB"+s+"XX"+s+"XY"); if(t==1) s+="B"; else if(t==2) s+="X"; else s+="Y"; } if(press(s+"B"+s+"X")) { if(press(s+"B")) s+="B"; else s+="X"; } else s+="Y"; } if(s=="B") { while(s.size()<n-1) { int t=press(s+"A"+s+"XA"+s+"XX"+s+"XY"); if(t==1) s+="A"; else if(t==2) s+="X"; else s+="Y"; } if(press(s+"A"+s+"X")) { if(press(s+"A")) s+="A"; else s+="X"; } else s+="Y"; } if(s=="X") { while(s.size()<n-1) { int t=press(s+"B"+s+"AB"+s+"AA"+s+"AY"); if(t==1) s+="B"; else if(t==2) s+="A"; else s+="Y"; } if(press(s+"B"+s+"A")) { if(press(s+"B")) s+="B"; else s+="A"; } else s+="Y"; } if(s=="Y") { while(s.size()<n-1) { int t=press(s+"B"+s+"XB"+s+"XX"+s+"XA"); if(t==1) s+="B"; else if(t==2) s+="X"; else s+="A"; } if(press(s+"B"+s+"X")) { if(press(s+"B")) s+="B"; else s+="X"; } else s+="A"; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:12: error: 'press' was not declared in this scope
    8 |         if(press("A")) return "A";
      |            ^~~~~
combo.cpp:13:11: error: 'press' was not declared in this scope
   13 |     int k=press("AB");
      |           ^~~~~
combo.cpp:26:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:42:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:58:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   58 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:74:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   74 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~