Submission #109148

#TimeUsernameProblemLanguageResultExecution timeMemory
109148kingfran1907Combo (IOI18_combo)C++14
0 / 100
2 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; const char koj[] = "ABXY"; string guess_sequence(int n) { string s; char ac = 'Z'; for (int i = 0; i < 3; i++) { string tren; tren += koj[i]; if (press(tren) == 1) ac = koj[i]; } if (ac == 'Z') ac = 'Y'; char a = 0, b = 0, c = 0; for (int i = 0; i < 4; i++) { if (koj[i] == ac) continue; if (a == 0) a = koj[i]; else if (b == 0) b = koj[i]; else c = koj[i]; } assert(a > 0 && b > 0 && c > 0); s += ac; for (int i = 1; i < n; i++) { string query = s + a + s + b + c + s + b + b; int kol = press(query); if (kol == s.size()) s.push_back(c); else if (kol == s.size() + 1) s.push_back(a); else s.push_back(b); }; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:25: 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 (kol == s.size()) s.push_back(c);
      |                     ~~~~^~~~~~~~~~~
combo.cpp:33:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |                 else if (kol == s.size() + 1) s.push_back(a);
      |                          ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...