Submission #1039059

#TimeUsernameProblemLanguageResultExecution timeMemory
1039059VMaksimoski008콤보 (IOI18_combo)C++17
10 / 100
36 ms956 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string S = ""; if(press("XY")) { if(press("X")) S += 'X'; else S += 'Y'; } else if(press("A")) { S += 'A'; } else { S += 'B'; } vector<char> vec; for(auto &ch : {'A', 'B', 'X', 'Y'}) if(ch != S[0]) vec.push_back(ch); //press(p) dava dolzina na najdolg prefix na S sto e substring na p while(S.size() < N) { for(char &ch : vec) { if(press(S + ch) == S.size() + 1) { S += ch; break; } } } return S; }

Compilation message (stderr)

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