Submission #206506

#TimeUsernameProblemLanguageResultExecution timeMemory
206506vardan__02Combo (IOI18_combo)C++14
0 / 100
51 ms2192 KiB
#include <algorithm> #include <iostream> #include <fstream> #include <cstring> #include <string> #include <vector> #include <cstdio> #include <queue> #include <deque> #include <stack> #include <list> #include <set> #include <map> #include "combo.h" using namespace std; string guess_sequence(int N) { int n=N; string ans=""; string ban=""; int v=0, x; if(n==2) { ans="XX"; x = press("XYYX"); if(x==0) { x = press("ABBA"); if(x==1) { x = press("AXBX"); if(x==1) ans[1]='Y'; else ans[1]='X'; x = press("A"); if(x==1) ans[0]='A'; else ans[0]='B'; } else { x = press("AB"); if(x==2) ans="AB"; else ans="BA"; } } else { if(x==1) { x = press("XAYA"); if(x==1) ans[1]='B'; else ans[1]='A'; x = press("X"); if(x==1) ans[0]='X'; else ans[0]='Y'; } else { x = press("XY"); if(x==2) ans="XY"; else ans="YX"; } } return ans; } x = press("A"); if(x==1) { ban="XYB"; ans="A"; } else { x = press("B"); if(x==1) { ban="XYA"; ans="B"; } else { x = press("X"); if(x==1) { ban="ABY"; ans="X"; } else { ban="ABX"; ans="Y"; } } } if(n==1) return ans; if(n%2==0) { string s=""; s=ans[0]+ban[0]+ban[1]+ban[0]+ans[0]+ban[1]+ban[0]+ban[1]; x = press(s); if(x==1) ans=ans+ban[2]; else if(x==3) { s=""; s=ans[0]+ban[0]+ban[1]; x = press(s); if(x==3) ans=ans+ban[0]+ban[1]+ban[2]; else ans=ans+ban[1]+ban[0]+ban[2]; } else { s=""; s=ans[0]+ban[0]+ban[2]+ban[0]+ans[0]+ban[1]+ban[2]+ban[1]; x = press(s); if(x==3) { s=""; s=ans[0]+ban[0]; x = press(s); if(x==1) ans=ans+ban[1]; else ans=ans+ban[0]; ans=ans+ban[2]+ban[2]; } else { s=""; s=ans[0]+ban[0]+ban[2]+ban[0]; x = press(s); if(x==4) ans=ans+ban[0]+ban[2]+ban[0]; else ans=ans+ban[1]+ban[2]+ban[1]; } } } while(ans.size()!=n) { string s=""; s=ans+ban[0]+ban[1]+ans+ban[1]+ban[0]; x = press(s); if(x==ans.size()) { ans=ans+ban[2]; s=ans+ban[0]; x = press(s); if(x==ans.size()+1) ans=ans+ban[0]; else ans=ans+ban[1]; } else { if(x==ans.size()+1) { s=ans+ban[0]+ban[2]; x = press(s); if(x==ans.size()+2) ans=ans+ban[0]+ban[2]; else ans=ans+ban[1]+ban[2]; } else { s=ans+ban[0]+ban[1]; x = press(s); if(x==ans.size()+2) ans=ans+ban[0]+ban[1]; else ans=ans+ban[1]+ban[0]; } } } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:154:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  154 |     while(ans.size()!=n)
      |           ~~~~~~~~~~^~~
combo.cpp:159:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  159 |         if(x==ans.size())
      |            ~^~~~~~~~~~~~
combo.cpp:164:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  164 |             if(x==ans.size()+1)
      |                ~^~~~~~~~~~~~~~
combo.cpp:171:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  171 |             if(x==ans.size()+1)
      |                ~^~~~~~~~~~~~~~
combo.cpp:175:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  175 |                 if(x==ans.size()+2)
      |                    ~^~~~~~~~~~~~~~
combo.cpp:184:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  184 |                 if(x==ans.size()+2)
      |                    ~^~~~~~~~~~~~~~
combo.cpp:21:9: warning: unused variable 'v' [-Wunused-variable]
   21 |     int v=0, x;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...