Submission #75139

#TimeUsernameProblemLanguageResultExecution timeMemory
75139dooweyCombo (IOI18_combo)C++14
100 / 100
57 ms612 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char ok[] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { string pref; if(press("AB") > 0){ if(press("A")) pref += "A"; else pref += "B"; } else{ if(press("X")) pref += "X"; else pref += "Y"; } vector<char> use; for(int i = 0;i < 4;i ++ ){ if(pref[0] != ok[i]) use.push_back(ok[i]); } string as; int sum; for(int i = 0;i < N-2; i ++ ){ as = pref + use[0] + pref + use[1] + use[0] + pref + use[1] + use[1] + pref + use[1] + use[2]; sum = press(as); if(sum == pref.size() + 1) pref += use[0]; else if(sum == pref.size() + 2) pref += use[1]; else pref += use[2]; } if(N == 1) return pref; if(press(pref + use[0]) == N) return pref + use[0]; else if(press(pref + use[1]) == N) return pref + use[1]; else return pref + use[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(sum == pref.size() + 1)
      |      ~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:34:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   else if(sum == pref.size() + 2)
      |           ~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...