Submission #975604

#TimeUsernameProblemLanguageResultExecution timeMemory
975604yeediotCombo (IOI18_combo)C++17
100 / 100
16 ms1920 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) x.begin(),x.end() #define pii pair<int,int> #define pb push_back #define sz(x) (int)(x.size()) #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) #define vi vector<int> #define vp vector<pii> #define vvi vector<vi> #define ykh mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()) #define __lg(x) 63-__builtin_clzll(x) #define pow2(x) (1LL<<x) string guess_sequence(int n){ string s; vector<char>v={'A','B','X','Y'}; string temp="AB"; int res=press(temp); if(res>0){ temp="A"; res=press(temp); if(!res)swap(v[0],v[1]); } else{ temp="X"; res=press(temp); if(res)swap(v[0],v[2]); else swap(v[0],v[3]); } s+=v[0]; if(n==1){ return s; } for(int i=1;i+1<n;i++){ temp=s+v[1]+v[1]+s+v[1]+v[2]+s+v[1]+v[3]+s+v[3]; res=press(temp); if(res==i+2)s+=v[1]; else if(res==i+1)s+=v[3]; else s+=v[2]; } if(press(s+v[1])==n)s+=v[1]; else if(press(s+v[2])==n)s+=v[2]; else s+=v[3]; return s; } /* input: */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...