Submission #162307

#TimeUsernameProblemLanguageResultExecution timeMemory
162307NordwayCombo (IOI18_combo)C++14
0 / 100
1 ms200 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 get_string(string s,int p){ if(p==1)return "B"+s+"XB"+s+"XX"+s+"XY"; else if(p==2)return "X"+s+"YX"+s+"YY"+s+"YA"; else if(p==3)return "Y"+s+"AY"+s+"AA"+s+"AB"; else if(p==4)return "A"+s+"BA"+s+"BB"+s+"BX"; } string get_char(int val,int p){ if(p==4){ if(val==0)return "X"; else if(val==1)return "A"; else return "B"; } else if(p==1){ if(val==0)return "Y"; else if(val==1)return "B"; else return "X"; } else if(p==2){ if(val==0)return "A"; else if(val==1)return "X"; else return "Y"; } else { if(val==0)return "B"; else if(val==1)return "Y"; else return "A"; } } string guess_sequence(int n){ string s=""; s="A"; int p; if(press(s)==1){ p=1; } else{ s="B"; if(press(s)==1){ p=2; } else{ s="X"; if(press(s)){ p=3; } else{ s="Y"; p=4; } } } for(int i=2;i<=n;i++){ string t=s+get_string(s,p); int val=press(s); if(val==sz(s))s=s+get_char(0,p); else if(val==sz(s)+1)s=s+get_char(1,p); else if(val==sz(s)+2)s=s+get_char(2,p); } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string get_string(std::string, int)':
combo.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...