Submission #75727

#TimeUsernameProblemLanguageResultExecution timeMemory
75727Markomafko972Combo (IOI18_combo)C++14
100 / 100
66 ms556 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string sol = ""; vector<char> v; if (press("AB") >= 1) { if (press("A") == 1) sol += 'A'; else sol += 'B'; } else { if (press("X") == 1) sol += 'X'; else sol += 'Y'; } if (N == 1) return sol; if (sol[0] != 'A') v.push_back('A'); if (sol[0] != 'B') v.push_back('B'); if (sol[0] != 'X') v.push_back('X'); if (sol[0] != 'Y') v.push_back('Y'); for (int i = 2; i < N; i ++) { string tren = ""; for (int j = 0; j < v.size(); j ++) { tren += sol + v[0] + v[j]; } tren += sol + v[1]; int t = press(tren); if (t >= i+1) { sol += v[0]; } else if (t == i) { sol += v[1]; } else { sol += v[2]; } } for (int i = 0; i < (int)v.size()-1; i ++) { if (press(sol + v[i]) == N) { return sol + v[i]; } } return sol + v[ (int)v.size()-1 ]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for (int j = 0; j < v.size(); j ++) {
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...