Submission #1032466

#TimeUsernameProblemLanguageResultExecution timeMemory
1032466ThommyDBCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = ""; if(press("AB")>=1){ if(press("A") >= 1) p+="A"; else p+="B"; } else{ if(press("X") >= 1) p+="X"; else p+="Y"; } if(N==1)return p; vector<char> a; for(auto u : "ABXY"){ if(u!=p[0]) a.push_back(u); } for(int i = 1; i<N-1; i++){ string s = ""; s+=p;s+=p;s+=p;s+=p;s.push_back(a[0]);s.push_back(a[0]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[1]);s.push_back(a[2]); int v = press(s); if(v == p.length() +1) p+=a[0]; else if(v==p.length()+2) p+=a[1]; else p+=a[2]; } if(press(p+a[0]) == N) p+=a[0] else if(press(p+a[1])==N) p+=a[1]; else p+=a[2]; return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     if(v == p.length() +1) p+=a[0];
      |        ~~^~~~~~~~~~~~~~~~
combo.cpp:29:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     else if(v==p.length()+2) p+=a[1];
      |             ~^~~~~~~~~~~~~~
combo.cpp:32:33: error: expected ';' before 'else'
   32 |   if(press(p+a[0]) == N) p+=a[0]
      |                                 ^
      |                                 ;
   33 |   else if(press(p+a[1])==N) p+=a[1];
      |   ~~~~