Submission #412681

#TimeUsernameProblemLanguageResultExecution timeMemory
412681snasibov05Combo (IOI18_combo)C++14
10 / 100
86 ms564 KiB
#include "combo.h" #include <vector> using namespace std; #define pb push_back string guess_sequence(int n) { vector<vector<bool>> v(n, vector<bool>(4, true)); string ans; int cur = 0; while (cur < n){ int k = cur; string str = ans; while (k < n){ if (v[k][0]) str.pb('A'); else if (v[k][1]) str.pb('B'); else if (v[k][2]) str.pb('X'); else str.pb('Y'); k++; } int x = press(str); if (cur == 0 && x > 0){ for (int i = 0; i < n; ++i) { if (str[0] == 'A') v[i][0] = false; else if (str[0] == 'B') v[i][1] = false; else if (str[0] == 'X') v[i][2] = false; else v[i][3] = false; } } for (int i = ans.size(); i < x; ++i) { ans += str[i]; cur++; } if (x < str.size()){ if (str[x] == 'A') v[x][0] = false; else if (str[x] == 'B') v[x][1] = false; else if (str[x] == 'X') v[x][2] = false; else v[x][3] = false; } } return ans; }

Compilation message (stderr)

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