Submission #769919

#TimeUsernameProblemLanguageResultExecution timeMemory
769919teamariaaCombo (IOI18_combo)C++17
0 / 100
1 ms208 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 == 1) { 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; idk = idk + letters[0] + idk + letters[1] +letters[0] + idk + letters[1] + letters[1] + idk + letters[1] +letters[2]; int cost = press(idk); 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:32:17: 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(cost == idk.size())
      |            ~~~~~^~~~~~~~~~~~~
combo.cpp:34:22: 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(cost == idk.size() + 1)
      |                 ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...