Submission #295744

#TimeUsernameProblemLanguageResultExecution timeMemory
295744zoooma13Combo (IOI18_combo)C++14
100 / 100
37 ms672 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string ret; if(press("AB")) ret = press("A")? "A" : "B"; else ret = press("X")? "X" : "Y"; string Cs = "ABXY"; Cs.erase(find(Cs.begin() ,Cs.end() ,ret[0])); while(ret.size() < N-1){ int coins = press(ret+Cs[0] + ret+Cs[1]+Cs[0] + ret+Cs[1]+Cs[1] + ret+Cs[1]+Cs[2]); if(coins == ret.size()) ret += Cs[2]; else if(coins-1 == ret.size()) ret += Cs[0]; else ret += Cs[1]; } if(ret.size() == N) return ret; if(press(ret+Cs[0]) == N) ret += Cs[0]; else if(press(ret+Cs[1]) == N) ret += Cs[1]; else ret += Cs[2]; return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |     while(ret.size() < N-1){
      |           ~~~~~~~~~~~^~~~~
combo.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if(coins == ret.size())
      |            ~~~~~~^~~~~~~~~~~~~
combo.cpp:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         else if(coins-1 == ret.size())
      |                 ~~~~~~~~^~~~~~~~~~~~~
combo.cpp:25:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     if(ret.size() == N)
      |        ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...