Submission #714177

#TimeUsernameProblemLanguageResultExecution timeMemory
714177AstraytCombo (IOI18_combo)C++17
30 / 100
48 ms492 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define pb push_back string guess_sequence(int N) { string S = ""; int tmp = press("AB"); if(tmp == 2) S += "A"; else if(tmp == 1){ tmp = press("A"); if(tmp) S += "A"; else S += "B"; }else{ tmp = press("X"); if(tmp) S += "X"; else S += "Y"; } vector<string> C; for(auto c:{"A", "B", "X", "Y"}){ if(c != S) C.pb(c); } while(S.size() != N){ tmp = press(S + C[0] + S + C[1]); if(tmp == S.size() + 1){ tmp = press(S + C[0]); if(tmp == S.size() + 1) S += C[0]; else S += C[1]; }else S += C[2]; } cerr << S << '\n'; return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |  while(S.size() != N){
      |        ~~~~~~~~~^~~~
combo.cpp:25:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   if(tmp == S.size() + 1){
      |      ~~~~^~~~~~~~~~~~~~~
combo.cpp:27:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |    if(tmp == S.size() + 1) S += C[0];
      |       ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...