Submission #468092

#TimeUsernameProblemLanguageResultExecution timeMemory
468092jjjCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p = ""; string s = "", a = "", b = "", c = ""; int coins = press("AB"); if(coins == 1) { coins = press("A"); if(coins == 1) { s += 'A'; a += 'B'; b += 'X'; c += 'Y'; } else { s += 'B'; a += 'A'; b += 'X'; c += 'Y'; } } else { coins = press("X"); if(coins == 1) { s += 'X'; a += 'B'; b += 'A'; c += 'Y'; } else { s += 'Y'; a += 'B'; b += 'X'; c += 'A'; } } for (int i = 0; i < N - 1; i++) { p = ""; p += s + a + a + s + a + b + s + a + c + s + b; cout << p << endl; coins = press(p); if(coins == 0) s += c; if(coins == 1) s += b; if(coins == 2) s += a; } if(s.size() < N) { if(press(s + a) == 1) s += a; else if(press(s + b) == 1) s += b; else if(press(s + c) == 1) s += c; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:69:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   69 |   if(s.size() < N)
      |      ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...