제출 #92801

#제출 시각아이디문제언어결과실행 시간메모리
92801psmao콤보 (IOI18_combo)C++14
100 / 100
60 ms632 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define fo(i,s,t) for(int i = s; i <= t; ++ i) #define fd(i,s,t) for(int i = s; i >= t; -- i) #define bf(i,s) for(int i = head[s]; i; i = e[i].next) #define mp make_pair #define fi first #define se second #define pii pair<int,int> #define pb push_back #define VI vector<int> #define sf scanf #define pf printf #define fp freopen #define SZ(x) ((int)(x).size()) #ifdef MPS #define D(x...) printf(x) #else #define D(x...) #endif typedef long long ll; typedef double db; typedef unsigned long long ull; const int inf = 1<<30; const ll INF = 1ll<<60; const db Inf = 1e20; const db eps = 1e-9; string convert(int x) { if(x == 1) return "A"; else if(x == 2) return "B"; else if(x == 3) return "X"; else return "Y"; } int candi[4]; string guess_sequence(int n) { int first; string ret = ""; if(press("AB")) { if(press("A")) first = 1, ret = "A"; else first = 2, ret = "B"; } else { if(press("X")) first = 3, ret = "X"; else first = 4, ret = "Y"; } srand(time(NULL)); fo(i,1,4) if(i != first) candi[i] = i; fo(i,2,n-1) { random_shuffle(candi+1,candi+3+1); fo(a,1,3) { fo(b,1,3) if(a != b) { string tmp = ret + convert(candi[a]); fo(c,1,3) tmp = tmp + ret + convert(candi[b]) + convert(candi[c]); int answer = press(tmp); if(answer == i + 1) ret = ret + convert(candi[b]); else if(answer == i) ret = ret + convert(candi[a]); else fo(k,1,3) if(k != a && k != b) {ret = ret + convert(candi[k]); break;} goto loop; } } loop:; } if(n != 1) { random_shuffle(candi+1,candi+3+1); string tmp = ret + convert(candi[1]) + ret + convert(candi[2]); if(press(tmp) == n) { tmp = ret + convert(candi[1]); if(press(tmp) == n) {ret = tmp; goto gg;} ret = ret + convert(candi[2]); goto gg; } ret = ret + convert(candi[3]); gg:; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...