Submission #503680

#TimeUsernameProblemLanguageResultExecution timeMemory
503680cristi_aCombo (IOI18_combo)C++17
10 / 100
48 ms468 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; string guess_sequence(int N) { vector<string> letters = {"A", "B", "X", "Y"}; string rez = ""; for(vector<string>::iterator i=letters.begin(); i!=letters.end(); i++) if(press(*i)) { rez = rez + *i; letters.erase(i); break; } for(int i=1; i<N; i++) { //cout << rez + letters[0] << " " << press(rez+letters[0]) << "\n"; //cout << rez + letters[1] << " " << press(rez+letters[1]) << "\n"; //cout << rez + letters[2] << " " << press(rez+letters[2]) << "\n\n"; if(press(rez+letters[0])==i+1) rez = rez + letters[0]; else if(press(rez+letters[1])==i+1) rez = rez + letters[1]; else rez = rez + letters[2]; } if(rez.size()==N) return rez; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     if(rez.size()==N) return rez;
      |        ~~~~~~~~~~^~~
combo.cpp:6:49: warning: control reaches end of non-void function [-Wreturn-type]
    6 |     vector<string> letters = {"A", "B", "X", "Y"};
      |                                                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...