Submission #516933

#TimeUsernameProblemLanguageResultExecution timeMemory
516933AngusWongCombo (IOI18_combo)C++17
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string s="ABXY", ans=""; for (int i=0; i<=2; i++){ if (press(s.substr(i, 1))){ ans=s.substr(i, 1); s.erase(s.begin()+i); break; } } if (ans==""){ ans="Y"; s.erase(s.begin()+3); } for (int i=2; i<n; i++){ int t=press(ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]); if (t==i+1) ans+=s[0]; else if (t==i) ans+=s[1]; else ans+=s[2]; } for (int i=0; i<=2; i++){ if (press(ans+s[i])==n){ ans+=s[i]; break; } } if (ans.length()!=n) ans+=s[3]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     if (ans.length()!=n) ans+=s[3];
      |         ~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...