Submission #297691

#TimeUsernameProblemLanguageResultExecution timeMemory
297691Leonardo16Combo (IOI18_combo)C++14
0 / 100
0 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define ii pair<int,int> #define vi vector<int> #define vii vector<ii > #define fst first #define scd second #define sz size #define pb push_back #define fl '\n' #define el endl #define all(x) x.begin(),x.end() string guess_sequence(int n) { char beg='A'; if(press("B")==1){ beg='B'; }else{ if(press("XY")>=1){ if( press("X")==1 ){ beg='X'; }else{ beg='Y'; } } } map<char,int>mp; mp['A']++; mp['B']++; mp['X']++; mp['Y']++; mp.erase(beg); vector<char>v; for(auto it:mp){ v.pb(it.fst); } string ret; ret+=beg; cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<fl; for(int i=2;i<=n;i++){ string ask; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[0]; if(i!=n){ for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[0]; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[1]; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } ask+=v[1]; ask+=v[2]; }else{ string ask; for(int j=0;j<ret.sz();j++){ ask+=ret[j]; } if(press(ask+v[0])==n){ ret+=v[0]; }else{ if(press(ask+v[1])==n){ ret+=v[1]; }else{ ret+=v[2]; } } break; } int x=press(ask); if(x==i){ ret+=v[0]; }else{ if(x==i+1){ ret+=v[1]; }else{ ret+=v[2]; } } cout<<ask<<" "<<x<<fl; cout<<ret<<fl; } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(int j=0;j<ret.sz();j++){
      |                     ~^~~~~~~~~
combo.cpp:68:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:73:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:78:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
combo.cpp:85:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |             for(int j=0;j<ret.sz();j++){
      |                         ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...