제출 #395316

#제출 시각아이디문제언어결과실행 시간메모리
395316grt콤보 (IOI18_combo)C++17
100 / 100
48 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" #define PB push_back #define ST first #define ND second #define _ ios_base::sync_with_stdio(0); cin.tie(0); //mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; //~ int press(string s) { //~ cout << s << "\n"; //~ int x; //~ cin >> x; //~ return x; //~ } //AXY string guess_sequence(int n) { char firstLet = 'x'; if(press("AX") > 0) { if(press("A")) firstLet = 'A'; else firstLet = 'X'; } else { if(press("B")) firstLet = 'B'; else firstLet = 'Y'; } string cur = string(1, firstLet); //4 * n -> s + 'B', s + 'X' + 'A' for(int i = 1; i < n; ++i) { if(i == n - 1) { int bad = 0; for(auto let : {'A', 'B', 'X', 'Y'}) { if(let == firstLet) continue; if(bad == 2) { cur += let; break; } int w = press(cur + let); if(w == n) { cur += let; break; } else { bad++; } } continue; } int id = 0; string s = ""; for(auto let : {'A', 'B', 'X', 'Y'}) { if(let == firstLet) continue; if(id == 0) { s += cur + let; } else if(id == 1) { for(auto let2 : {'A', 'B', 'X', 'Y'}) { if(let2 == firstLet) continue; s += cur + let + let2; } } id++; } int w = press(s); id = 0; for(auto let : {'A', 'B', 'X', 'Y'}) { if(let == firstLet) continue; if(w == i) { if(id == 2) cur += let; } else if(w == i + 1) { if(id == 0) cur += let; } else { if(id == 1) cur += let; } id++; } } return cur; } //~ int main() { //~ cout << "ANS: " << guess_sequence(3); //~ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...