Submission #154063

#TimeUsernameProblemLanguageResultExecution timeMemory
154063nthoangCombo (IOI18_combo)C++11
30 / 100
94 ms436 KiB
#include <bits/stdc++.h> #ifndef LOCAL #include "combo.h" #endif #ifdef LOCAL #include "/Users/nth842002/Library/debug.h" int press(string p) { } int main() { } #endif using namespace std; const string moves = "ABXY"; string guess_sequence(int n) { srand(time(0)); string s; for (int i = 0; i < 3; i++) { string t; t += moves[i]; if (press(t) == 1) { s += moves[i]; break; } } if (s.empty()) { s += moves[3]; } string avail; for (int i = 0; i < 4; i++) { if (moves[i] != s[0]) { avail += moves[i]; } } for (int i = 1; i < n; i++) { random_shuffle(avail.begin(), avail.end()); for (int j = 0; j < 2; j++) { s += avail[j]; if (press(s) == i + 1) { break; } s.pop_back(); } if (s.length() == i) { s += avail[2]; } } assert((int) s.length() == n); return s; }

Compilation message (stderr)

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