Submission #340273

#TimeUsernameProblemLanguageResultExecution timeMemory
340273FystyCombo (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==s.size()+1) s+="B"; else if(t==s.size()+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==s.size()+1) s+="A"; else if(t==s.size()+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==s.size()+1) s+="B"; else if(t==s.size()+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==s.size()+1) s+="B"; else if(t==s.size()+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; } /* int main() { int n; string s; cin>>n>>s; cout<<guess_sequence(n); } */

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:30:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(t==s.size()+1) s+="B";
      |                ~^~~~~~~~~~~~
combo.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             else if(t==s.size()+2) s+="X";
      |                     ~^~~~~~~~~~~~
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:46:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             if(t==s.size()+1) s+="A";
      |                ~^~~~~~~~~~~~
combo.cpp:47:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             else if(t==s.size()+2) s+="X";
      |                     ~^~~~~~~~~~~~
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:62:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |             if(t==s.size()+1) s+="B";
      |                ~^~~~~~~~~~~~
combo.cpp:63:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |             else if(t==s.size()+2) s+="A";
      |                     ~^~~~~~~~~~~~
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)
      |               ~~~~~~~~^~~~
combo.cpp:78:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |             if(t==s.size()+1) s+="B";
      |                ~^~~~~~~~~~~~
combo.cpp:79:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |             else if(t==s.size()+2) s+="X";
      |                     ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...