Submission #116702

#TimeUsernameProblemLanguageResultExecution timeMemory
116702tselmegkhCombo (IOI18_combo)C++14
100 / 100
58 ms708 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define INF 1e9 #define MAX 100005 #define xx first #define yy second #define pb push_back #define mp make_pair #define ull long long #define FOR(i,a,b) for(int i=a;i<=b;i++) #define nl '\n' #define zai <<' '<< #define all(a) a.begin(),a.end() #define pc __builtin_popcount #define debug(x) cerr << #x << " = " << (x) << ", " typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; template<class C> void mini(C &_a, C _b) { _a = min(_a, _b); } template<class C> void maxi(C &_a, C _b) { _a = max(_a, _b); } int press(string p); string guess_sequence(int n){ string ans; char cant; vector<char> v={'A','B','X','Y'}; int q1=press("AB"); if(q1){ if(press("A")){ ans+="A"; v.erase(v.begin()); } else{ ans+="B"; v.erase(v.begin()+1); } } else{ if(press("X")){ ans+="X"; v.erase(v.begin()+2); } else{ ans+="Y"; v.erase(v.begin()+3); } } if(n==1)return ans; for(int i=1;i<n-1;i++){ int q=press(ans+v[0]+v[0]+ans+v[0]+v[1]+ans+v[0]+v[2]+ans+v[1]); int sz=ans.size(); if(q==sz){ ans+=v[2]; } else if(q==sz+1){ ans+=v[1]; } else if(q==sz+2){ ans+=v[0]; } } //if(n>1){ if(press(ans+v[0])==n){ ans+=v[0]; } else if(press(ans+v[1])==n){ ans+=v[1]; } else ans+=v[2]; // } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:7: warning: unused variable 'cant' [-Wunused-variable]
   27 |  char cant;
      |       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...