Submission #770043

#TimeUsernameProblemLanguageResultExecution timeMemory
770043teamariaaCombo (IOI18_combo)C++17
100 / 100
31 ms536 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s, letters; int cost = press("AB"); if(cost > 0) { cost = press("A"); if(cost == 1) s += 'A', letters += "BXY"; else s += 'B', letters += "AXY"; } else { cost = press("X"); if(cost == 1) s += 'X', letters += "ABY"; else s += 'Y', letters += "ABX"; } // cout << s << " " << letters << "\n"; for(int i = 2; i <= N - 1; i++) { string x; x = s + letters[0] + s + letters[1] +letters[0] + s + letters[1] + letters[1] + s + letters[1] +letters[2]; int cost = press(x); if(cost == s.size()) s += letters[2]; else if(cost == s.size() + 1) s += letters[0]; else s += letters[1]; // cout << s << "\n"; } if(N > 1) { string idk = s; if(press(idk + letters[0]) == N) s += letters[0]; else if(press(idk + letters[1]) == N) s += letters[1]; else s += letters[2]; } return s; }

Compilation message (stderr)

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