제출 #807420

#제출 시각아이디문제언어결과실행 시간메모리
807420OAleksa콤보 (IOI18_combo)C++14
100 / 100
25 ms580 KiB
#include <bits/stdc++.h> #include "combo.h" #define f first #define s second using namespace std; // int press(string p) { // cout << p << endl; // int x; // cin >> x; // return x; // } // // string guess_sequence(int N) { string s; if(N == 1) { if(press("A")) return "A"; else if(press("B")) return "B"; else if(press("X")) return "X"; else return "Y"; } if(press("AB")) { if(press("A")) s += "A"; else s += "B"; } else { if(press("X")) s += "X"; else s += "Y"; } for(int i = 1;i < N - 1;i++) { if(s[0] == 'A') { int x = press(s + "BB" + s + "BX" + s + "BY" + s + "Y"); if(x == i) s += "X"; else if(x == i + 1) s += "Y"; else s += "B"; } else if(s[0] == 'B') { int x = press(s + "AA" + s + "AX" + s + "AY" + s + "Y"); if(x == i) s += "X"; else if(x == i + 1) s += "Y"; else s += "A"; } else if(s[0] == 'X') { int x = press(s + "AA" + s + "AB" + s + "AY" + s + "Y"); if(x == i) s += "B"; else if(x == i + 1) s += "Y"; else s += "A"; } else { int x = press(s + "AA" + s + "AB" + s + "AX" + s + "X"); if(x == i) s += "B"; else if(x == i + 1) s += "X"; else s += "A"; } } int k = s.size(); if(s[0] == 'A') { if(press(s + "B") > k) s += "B"; else if(press(s + "X") > k) s += "X"; else s += "Y"; } else if(s[0] == 'B') { if(press(s + "A") > k) s += "A"; else if(press(s + "X") > k) s += "X"; else s += "Y"; } else if(s[0] == 'X') { if(press(s + "A") > k) s += "A"; else if(press(s + "B") > k) s += "B"; else s += "Y"; } else { if(press(s + "B") > k) s += "B"; else if(press(s + "X") > k) s += "X"; else s += "A"; } return s; } // // // int main() // { // ios_base::sync_with_stdio(false); // cin.tie(0); // cout.tie(0); // int tt = 1; // //cin >> tt; // while(tt--) { // int n; // cin >> n; // cout << guess_sequence(n) << endl; // } // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...