Submission #1022979

#TimeUsernameProblemLanguageResultExecution timeMemory
1022979HishamAlshehriCombo (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = ""; string t = "ABXYABXY"; int c = press("ABB"); if (c == 2) { s += 'A'; } else if (c == 1) s += 'B'; else { c = press("XYY"); if (c == 1) s += 'Y'; else s += 'X'; } int idx = 0; for (int i = 0; i < 4; i++) if(s[0] == t[i]) {idx = i; break;} char q1 = t[idx + 1], q2 = t[idx + 2], q3 = t[idx + 3]; for (int i = 1; i < N; i++) { c = press(s + q1 + s + q2 + q1 + s + q2 + q2 + s + q2 + q3); if (c == s.size()) s += q3; else if (c == s.size() + 1) s += q1; else s += q2; } return s; }

Compilation message (stderr)

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