이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 2005
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;
for(ll i = 2;i<=n-1;i++){
ll c;
a[i+2] = a[1];
//here;
for(ll j = 1;j<=m-1;j++){
if(b[i][j]) continue;
a[i] = j;
a[i+1] = j;
c = press(conv(i+2));
//cerr<<conv(i+2)<< " "<<c<<endl;
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] = m;
lol1:;
}
for(ll j = 1;j<=m-1;j++){
a[n] = j;
ll c = press(conv(n));
if(c==n){
ans = conv(n);
goto lol;
}
}
a[n] = m;
ans = conv(n);
lol:;
cerr<<ans<<endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |