Submission #490771

#TimeUsernameProblemLanguageResultExecution timeMemory
490771CyberSleeperCombo (IOI18_combo)C++14
10 / 100
74 ms452 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string ch="ABXY"; int in; string guess_sequence(int N) { bool pref=0; string S; for(auto i:ch){ S=i; in=press(S); if(in) break; } while(!pref){ pref=1; for(auto i:ch){ string tmp=i+S; in=press(tmp); if(in==tmp.size()){ pref=0; S=tmp; break; } } } while(S.size()<N){ S=S+"0"; for(auto i:ch){ if(i==S[0]) continue; S.back()=i; in=press(S); if(in==S.size()) break; } } return S; }

Compilation message (stderr)

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