Submission #547220

#TimeUsernameProblemLanguageResultExecution timeMemory
547220uroskCombo (IOI18_combo)C++14
5 / 100
1 ms312 KiB
#include "combo.h" #define here cerr<<"===========================================\n" #include <bits/stdc++.h> #define ld double #define ll long long #define ull unsigned long long #define llinf 100000000000000000LL // 10^17 #define iinf 2000000000 // 2*10^9 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pii pair<int,int> #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {for(ll i = l;i<=r;i++) cerr<<a[i]<< " ";cerr<<endl;} using namespace std; #define maxn 8005 ll n; string ans; string p; ll a[maxn]; bool b[maxn][5]; vector<char> v = {'.','A','B','X','Y'}; string conv(ll len){ string ans = ""; for(ll i = 1;i<=len;i++) ans.pb(v[a[i]]); return ans; } ll m = 4; string guess_sequence(int N) { n = N; ll pr = -1; for(ll i = 1;i<=m-1;i++){ a[1] = i; ll c = press(conv(1)); if(c==1) pr = i; } if(pr==-1) pr = m; a[1] = pr; ll cnt1 = 0; ll ls = 0; for(ll i = 1;i<=m;i++){ if(i==a[1]) continue; if(cnt1==2){ ls = i; continue; } cnt1++; } for(ll i = 2;i<=n-1;i++){ ll c; //here; ll len = i+2+n; a[len] = a[1]; ll cnt = 0; for(ll j = 1;j<=m;j++){ if(j==a[1]) continue; if(cnt==2) continue; cnt++; if(b[i][j]) continue; for(ll k = i;k<len;k++) a[k] = j; c = press(conv(len)); //cerr<<conv(i+2)<< " "<<c<<endl; if(c<i) continue; a[i] = j; for(ll k = i+1;k<=c;k++){ a[k] = j; i++; } b[c+1][j] = 1; goto lol1; if(c==i+1){ a[i] = j; a[i+1] = j; i++; goto lol1; } if(c==i){ a[i] = j; b[i+1][j] = 1; goto lol1; } } a[i] = ls; lol1:; } ll cnt = 0; for(ll j = 1;j<=m;j++){ if(j==a[1]) continue; if(cnt==2) continue; cnt++; a[n] = j; ll c = press(conv(n)); if(c==n){ ans = conv(n); goto lol; } } a[n] = ls; ans = conv(n); lol:; cerr<<ans<<endl; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...