제출 #571139

#제출 시각아이디문제언어결과실행 시간메모리
571139sentheta콤보 (IOI18_combo)C++17
5 / 100
2 ms208 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; #define V vector #define rep(i,a,b) for(int i=(a); i<(b); i++) #define sz (int)s.size() string guess_sequence(int n){ V<char> arr = {'A','B','X','Y'}; string s; // find first char { int ax = press("AX"), bx = press("BX"); if(ax && bx) s = "X"; else if(ax) s = "A"; else if(bx) s = "B"; else s = "Y"; } // put s[0] as last char { int i = 0; while(arr[i] != s[0]) i++; swap(arr[i], arr[3]); } //cout << s << endl; while(sz < n-1){ string t = ""; t += s; t += arr[0]; t += arr[0]; t += s; t += arr[0]; t += arr[1]; t += s; t += arr[0]; t += arr[2]; t += s; t += arr[1]; //cout << t << endl; int len = press(t); if(len==sz) s += arr[2]; else if(len==sz+1) s += arr[1]; else s += arr[0]; } //assert(sz == n-1); //cout << s << endl; // last char string t; t += s; t += arr[0]; t += s; t += arr[1]; if(press(t) > sz){ t = ""; t += s; t += arr[0]; if(press(t) > sz) s += arr[0]; else s += arr[1]; } else s += arr[2]; //cout << s << endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...