Submission #955855

#TimeUsernameProblemLanguageResultExecution timeMemory
955855ASGA_RedSeaCombo (IOI18_combo)C++17
30 / 100
20 ms1464 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; //int press(string s){cout<<"press : "<<s<<" : ";int r;cin>>r;return r;} string guess_sequence(int n){ string s,c = "ABXY"; int f = 0; for(int i = 0;i < 3;i++){ f = press(string(1,c[i])); if(f){s += c[i];c.erase(i,1);break;} } if(!f){s += c.back();c.pop_back();} for(int i = 1;i < n;i++){ f = 0; for(int j = 0;j < 2;j++){ if(press(s + string(1,c[j])) > s.size()){f = 1;s += c[j];break;} } if(!f){s += c.back();} } 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:20:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if(press(s + string(1,c[j])) > s.size()){f = 1;s += c[j];break;}
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...