Submission #162317

#TimeUsernameProblemLanguageResultExecution timeMemory
162317NordwayCombo (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 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(p!=1)c+="A"; if(p!=2)c+="B"; if(p!=3)c+="X"; if(p!=4)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(s); if(val==sz(s))s+=c[2]; else if(val==sz(s)+1)s+=c[0]; else 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:47:3: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |   if(p!=1)c+="A";
      |   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...