Submission #526668

#TimeUsernameProblemLanguageResultExecution timeMemory
526668lcs147Combo (IOI18_combo)C++17
30 / 100
47 ms468 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; string guess_sequence(int n) { set<char> possible = {'A','B','X','Y'}; string res; while(res.size() < n) { auto possible2 = possible; char last = *prev(possible.end()); possible.erase(last); char cur = last; for(char c:possible) { if(press(res+c) == res.size()+1) { cur = c; break; } } res += cur; possible = possible2; if(res.size() == 1) possible.erase(cur); } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     while(res.size() < n) {
      |           ~~~~~~~~~~~^~~
combo.cpp:17:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if(press(res+c) == res.size()+1) {
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...