Submission #340271

#TimeUsernameProblemLanguageResultExecution timeMemory
340271FystyCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); 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:27:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:43:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:59:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
combo.cpp:75:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |         while(s.size()<n-1)
      |               ~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...