Submission #162321

#TimeUsernameProblemLanguageResultExecution timeMemory
162321NordwayCombo (IOI18_combo)C++14
100 / 100
53 ms548 KiB
#include"combo.h" #include<bits/stdc++.h> #define x first #define y second #define pb push_back #define mp make_pair #define up_b upper_bound #define low_b lower_bound #define sz(x) (int)x.size() #define all(v) v.begin(),v.end() #define nl '\n' #define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<int,ll> pil; typedef pair<ll,int> pli; typedef pair<ll,ll> pll; const ll INF=1e18; const int inf=1e9; const ld eps=1e-7; const ld pi=acos(-1); const int dx[8]={0,0 ,1,-1,1,1,-1,-1}; const int dy[8]={1,-1,0,0,1,-1,1,-1}; const int mod1=998244353; const int mod=1e9+7; const int N=5e5+11; const int M=511111; string guess_sequence(int n){ string s=""; s="A"; if(press("AB")){ if(press("A"))s="A"; else s="B"; } else{ if(press("X"))s="X"; else s="Y"; } int p; string c=""; if(s!="A")c+="A"; if(s!="B")c+="B"; if(s!="X")c+="X"; if(s!="Y")c+="Y"; for(int i=2;i<n;i++){ string t=s+c[0]+s+c[1]+c[0]+s+c[1]+c[1]+s+c[1]+c[2]; int val=press(t); if(val==sz(s))s+=c[2]; if(val==sz(s)+1)s+=c[0]; if(val==sz(s)+2)s+=c[1]; } if(n>1){ if(press(s+c[0])==n)s+=c[0]; else if(press(s+c[1])==n)s+=c[1]; else s+=c[2]; } return s; }

Compilation message (stderr)

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