Submission #769927

#TimeUsernameProblemLanguageResultExecution timeMemory
769927teamariaaCombo (IOI18_combo)C++17
5 / 100
1 ms276 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s, letters; s.clear(); 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"; } for(int i = 2; i <= N - 1; i++) { string idk = s; string x; x = idk + letters[0] + idk + letters[1] +letters[0] + idk + letters[1] + letters[1] + idk + letters[1] +letters[2]; int cost = press(x); if(cost == idk.size()) s += letters[2]; else if(cost == idk.size() + 1) s += letters[0]; else s += letters[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:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         if(cost == idk.size())
      |            ~~~~~^~~~~~~~~~~~~
combo.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         else if(cost == idk.size() + 1)
      |                 ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...