Submission #795814

#TimeUsernameProblemLanguageResultExecution timeMemory
795814gagik_2007Combo (IOI18_combo)C++17
5 / 100
1 ms216 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=5007; ll n,m,k; string guess_sequence(int NN) { n=NN; string pf=""; if(press("AB")){ if(press("A"))pf="A"; else pf="B"; } else if(press("X"))pf+="X"; else pf+="Y"; vector<char>rem; for(char c:{'A','B','X','Y'}){ if(c!=pf[0])rem.push_back(c); } for(int _=0;_<n-2;_++){ string cur=""; cur+=pf+rem[0]+rem[0]; cur+=pf+rem[0]+rem[1]; cur+=pf+rem[0]+rem[2]; cur+=pf+rem[1]; int res=press(cur); if(res==pf.size())pf+=rem[2]; else if(res==pf.size()+1)pf+=rem[1]; else pf+=rem[0]; } if(press(pf+rem[0])==pf.size()+1)pf+=rem[0]; else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1]; else pf+=rem[2]; return pf; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if(res==pf.size())pf+=rem[2];
      |            ~~~^~~~~~~~~~~
combo.cpp:40:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         else if(res==pf.size()+1)pf+=rem[1];
      |                 ~~~^~~~~~~~~~~~~
combo.cpp:43:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     if(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
      |        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
      |             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...