Submission #701028

#TimeUsernameProblemLanguageResultExecution timeMemory
701028BobCompetitiveProgrammingCombo (IOI18_combo)C++14
30 / 100
49 ms552 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; /* int press(string s){ cout << " IN PRESS, ans with string s = " << s << endl; ll ret; cin>>ret; return ret; } */ int press(std::string p); string guess_sequence(int N){ string S = "", first; vector<string> buttons{"A", "B", "X", "Y"}; for(auto& button : buttons) if(button=="Y" || press(button)){ first = button, S += button; break; } while(true){ if(S.size() == N) return S; for(auto& button : buttons) { if(button == first) continue; if(button=="Y" || (first=="Y" && button =="X") || press(S + button) > S.size()) { S += button; break; } } } } /* int main(){ guess_sequence(5); } */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         if(S.size() == N)
      |            ~~~~~~~~~^~~~
combo.cpp:29:81: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if(button=="Y" || (first=="Y" && button =="X") || press(S + button) > S.size()) {
      |                                                               ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...