제출 #921330

#제출 시각아이디문제언어결과실행 시간메모리
921330AverageAmogusEnjoyer콤보 (IOI18_combo)C++17
10 / 100
26 ms1372 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; } template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; } int press(string p); string guess_sequence(int n) { srand(time(nullptr)); string res = ""; vector<string> v = {"A","B","X","Y"}; string F; for (auto &x: v) { if (press(x) == 1) { F = x; break; } } res += F; for (int i=2;i<=n;i++) { vector<bool> tried(4); while(true) { int x; do { x = rand() % 4; } while(tried[x] || v[x] == F); tried[x] = true; if (press(res+v[x]) == i) { res += v[x]; break; } } } return res; } /* string W = "ABXYY"; int sz = 5; int press(string p) { for (int i=1;i<=sz;i++) { if (p.find(W.substr(0,i)) == string::npos) { return i-1; } } return sz; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << guess_sequence(sz) << endl; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...