Submission #1021468

#TimeUsernameProblemLanguageResultExecution timeMemory
1021468khomeCombo (IOI18_combo)C++17
30 / 100
34 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { vector<string> a; a={"A", "B", "X", "Y"}; string res, cur, per = ""; int n; for (string i : a){ if (press(i) == 1){ per = i; res+=i; break; } } while (res.size()!=N){ n = res.size(); for (string i:a){ if (i != per && i != res[-1]+"0"){ // cout << "current res = " << res << ' '; cur = res; while (res.size()!=N){ res+=i; } // cout << " after = " << res << ' '; int p = press(res); if (p > n){ cur=""; for (int j = 0; j < p; j++){ cur += res[j]; } // cout << "changed = " << cur << ' '; } res = cur; // cout << "\n"; } } } return res; }

Compilation message (stderr)

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