제출 #887731

#제출 시각아이디문제언어결과실행 시간메모리
887731oblantis콤보 (IOI18_combo)C++17
100 / 100
17 ms1952 KiB
#include <bits/stdc++.h> #include "combo.h" #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const int inf = 1e9 + 10000; const int mod = 1e9+7; const int maxn = 5e5 + 12; //int press(std::string p) { //if (++num_moves > MAX_NUM_MOVES) { //wrong_answer("too many moves"); //} //int len = p.length(); //if (len > 4 * N) { //wrong_answer("invalid press"); //} //for (int i = 0; i < len; ++i) { //if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') { //wrong_answer("invalid press"); //} //} //int coins = 0; //for (int i = 0, j = 0; i < len; ++i) { //if (j < N && S[j] == p[i]) { //++j; //} else if (S[0] == p[i]) { //j = 1; //} else { //j = 0; //} //coins = std::max(coins, j); //} //return coins; //} string guess_sequence(int n){ string s = "", a = ""; int wt = press("AB"); if(wt) { wt = press("A"); if(wt)s = "A", a = "BXY"; else s = "B", a = "AXY"; } else { wt = press("X"); if(wt)s = "X", a = "ABY"; else s = "Y", a = "ABX"; } if(n == 1)return s; for(int i = 1; i < n - 1; i++) { wt = press(s + a[0] + s + a[1] + a[0] + s + a[1] + a[1] + s + a[1] + a[2]); if(wt == i)s += a[2]; else if(wt == i + 1)s += a[0]; else if(wt == i + 2)s += a[1]; } wt = press(s + a[0] + s + a[1]); if(wt == n){ wt = press(s + a[0]); if(wt == n)s += a[0]; else s += a[1]; } else s += a[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...