Submission #138491

#TimeUsernameProblemLanguageResultExecution timeMemory
138491ckodserCombo (IOI18_combo)C++14
5 / 100
2 ms260 KiB
#include "combo.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define ld long double #define F first #define S second #define mp make_pair #define pii pair<ll,ll> using namespace :: std; const ll maxn=1e5+500; const ll inf=1e9+900; const string d[4]={"A","B","X","Y"}; vector<string> t; string findNext(string s){ ll res01=press(s+d[0]+s+d[1]); ll res02=press(s+d[0]+s+d[2]); if(res01>=s.size()+1){ if(res02>=s.size()+1){ return d[0]; }else{ return d[1]; } }else{ if(res02>=s.size()+1){ return d[2]; }else{ return d[3]; } } } string guess_sequence(int N) { string p = findNext(""); for(ll i=0;i<4;i++){ if(d[i]!=p){ t.pb(d[i]); } } if(press(p)!=1){ exit(1); } for(ll i=1;i<N-1;i++){ ll res=press(p+t[1]+p+t[2]+t[0]+p+t[2]+t[1]+p+t[2]+t[2]); if(res==p.size()){ p+=t[0]; } if(res==p.size()+1){ p+=t[1]; } if(res==p.size()+2){ p+=t[2]; } } p+=findNext(p); return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string findNext(std::string)':
combo.cpp:21:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if(res01>=s.size()+1){
      |        ~~~~~^~~~~~~~~~~~
combo.cpp:22:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  if(res02>=s.size()+1){
      |     ~~~~~^~~~~~~~~~~~
combo.cpp:28:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if(res02>=s.size()+1){
      |     ~~~~~^~~~~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:47:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |  if(res==p.size()){
      |     ~~~^~~~~~~~~~
combo.cpp:50:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  if(res==p.size()+1){
      |     ~~~^~~~~~~~~~~~
combo.cpp:53:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  if(res==p.size()+2){
      |     ~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...