제출 #1066560

#제출 시각아이디문제언어결과실행 시간메모리
1066560guanex콤보 (IOI18_combo)C++14
30 / 100
26 ms1600 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef long long ll; typedef vector<ll> vll; typedef pair<long long, long long> pll; typedef pair<char, int> ci; typedef pair<string, int> si; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; #define pb push_back #define fi first #define se second #define whole(v) v.begin(), v.end() #define rwhole(v) v.rbegin(), v.rend() #define inf INT_MAX/2 #define fro front std::string guess_sequence(int N) { string s; char fi; int c = press("A"); if(c){ fi = 'A'; }else{ c = press("B"); if(c){ fi = 'B'; }else{ c = press("X"); if(c){ fi = 'X'; }else{ fi = 'Y'; } } } char x = 'Y'; if(fi == 'Y'){ x = 'X'; } char y = 'B'; if(fi == 'B'){ y = 'X'; } char z = 'A'; if(fi == 'A'){ z = 'X'; } s.pb(fi); int lc = 1; for(int i = 1; i < N; ++i){ if(lc > i){ continue; } int c; if(i == N-1){ c = press(s + x); if(c > lc){ s.pb(x); }else{ c = press(s + y); if(c > lc){ s.pb(y); }else{ s.pb(z); } } break; } string a[4]; a[0] = s + x + y; a[1] = s + y + x; a[2] = s + x + x; a[3] = s + y + y; c = press(a[0] + a[1] + a[2] + a[3]); //cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << endl; //cout << c << endl; if(c == lc){ s.pb(z); lc++; }else if(lc + 1 == c){ c = press(a[0]); if(c > lc){ s.pb(x); }else{ s.pb(y); } s.pb(z); lc += 2; }else{ c = press(a[0]); if(c == lc+1){ s.pb(x); s.pb(x); }else if(c == lc){ c = press(a[1]); if(c == lc + 1){ s.pb(y); s.pb(y); }else{ s.pb(y); s.pb(x); } }else{ s.pb(x); s.pb(y); } lc += 2; } } //cout << s << endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...