Submission #1004372

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10043722024-06-21 08:22:03The_SamuraiCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include "combo.h"
#include "bits/stdc++.h"
using namespace std;
int counter;
int ask(string t) {
counter++;
return press(t);
}
string guess_sequence(int n) {
string s = "ABXY", ans = "";
for (int i = 0; i < 4 and n == 1; i++) {
if (press(string(s[i], 1))) return string(s[i], 1);
}
if (ask("AB") >= 1) {
// if (press("A")) ans = "A";
// else ans = "B";
ans = (ask("A") ? "A" : "B");
} else {
// if (press("X")) ans = "X";
// else ans = "Y";
ans = (ask("X") ? "X" : "Y");
}
s.erase(find(s.begin(), s.end(), ans[0]));
for (int i = 1; i < n - 1; i++) {
string t = "";
t += ans + s[0];
t += ans + s[1] + s[0];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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 (val == ans.size()) ans += s[2];
      |             ~~~~^~~~~~~~~~~~~
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 (val == ans.size() + 1) ans += s[0];
      |                  ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if (ask(ans) == ans.size()) break;
      |             ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:44:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |     if (ans.size() != n) ans += s[2];
      |         ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...