제출 #600544

#제출 시각아이디문제언어결과실행 시간메모리
600544jack715콤보 (IOI18_combo)C++14
5 / 100
1 ms220 KiB
#include "combo.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define pp pop_back #define mp make_pair #define bb back #define ff first #define ss second using namespace std; string pos = "ABXY"; string guess_sequence(int n) { string f = "AB"; if (press(f) != 0) { f = "A"; if (press(f) == 0) f = "B"; } else { f = "X"; if (press(f) == 0) f = "Y"; } string s = ""; for (int i = 0; i < 4*n; i++) s += f; string rem = ""; for (int i = 0; i < 4; i++) { if (pos[i] == f[0]) continue; rem += pos[i]; } // cout << f << '\n'; for (int i = 1; i < n-1; i++) { // cout << s << '\n'; s[i] = rem[0]; s[i+n] = rem[1]; s[i+n+1] = rem[0]; s[i+2*n] = rem[1]; s[i+2*n+1] = rem[1]; s[i+3*n] = rem[1]; s[i+3*n+1] = rem[2]; int now = press(s); if (now == i+1) s[i] = rem[0], s[i+n] = rem[0], s[i+n*2] = rem[0], s[i+n*3] = rem[0]; else if (now == i+2) s[i] = rem[1], s[i+n] = rem[1], s[i+n*2] = rem[1], s[i+n*3] = rem[1]; else s[i] = rem[2], s[i+n] = rem[2], s[i+n*2] = rem[2], s[i+n*3] = rem[2]; s[i+1] = f[0], s[i+n+1] = f[0], s[i+n*2+1] = f[0], s[i+n*3+1] = f[0]; } s[n-1] = rem[0]; s[n*2-1] = rem[1]; if (press(s) == n) { s[n*2-1] = f[0]; if (press(s) != n) s[n-1] = rem[1]; } else s[n-1] = rem[2]; s = s.substr(0, n); return s; } /* ABXYY */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...