Submission #84828

#TimeUsernameProblemLanguageResultExecution timeMemory
84828SirCenessCombo (IOI18_combo)C++14
5 / 100
2 ms252 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string head = ""; string str = ""; str = "AB"; if (press(str)){ str = "A"; if (press(str)){ head = "A"; } else head = "B"; } else { str = "X"; if (press(str)){ head = "X"; } else head = "Y"; } char a, b, c; if (head[0] == 'A'){ a = 'B'; b = 'X'; c = 'Y'; } else if (head[0] == 'B'){ a = 'A'; b = 'X'; c = 'Y'; } else if (head[0] == 'X'){ a = 'B'; b = 'A'; c = 'Y'; } else if (head[0] == 'Y'){ a = 'B'; b = 'X'; c = 'A'; } for (int i = 0; i < N-2; i++){ str = ""; str += head; str += a; str += a; str += head; str += a; str += b; str += head; str += a; str += c; str += head; str += b; int size = head.size(); int coins = press(str); if (coins == size+2) head += a; else if (coins == size+1) head += b; else if (coins == size) head += c; } str = ""; str += head; str += a; str += head; str += b; if (press(str) == head.size()){ head += c; } else { str = head + a; if (press(str) == head.size()) head += b; else head += a; } return head; } /* string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } return S; */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:70:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |  if (press(str) == head.size()){
      |      ~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:74:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |   if (press(str) == head.size()) head += b;
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...