Submission #955588

#TimeUsernameProblemLanguageResultExecution timeMemory
955588ASGA_RedSeaCombo (IOI18_combo)C++17
10 / 100
26 ms1448 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; //int press(string s){cout<<"press : "<<s<<" : ";int r;cin>>r;return r;} string guess_sequence(int n){ string s; string arr = "ABXY"; for(auto& i : arr){ string ss;ss += i; if(press(ss) == 1){ s += i; break; } } arr.erase(find(arr.begin(),arr.end(),s[0]) - arr.begin(),1); while(s.size() < n){ string p = s; for(auto& i : arr){ p += i; int r = press(p); if(r == s.size() + 1)break; p.pop_back(); } s = p; } return s; } //int main(){int n;cin>>n;cout<<guess_sequence(n);return 0;}

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:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             if(r == s.size() + 1)break;
      |                ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...