제출 #642606

#제출 시각아이디문제언어결과실행 시간메모리
642606MadokaMagicaFanPassword (RMI18_password)C++14
50 / 100
380 ms700 KiB
#include "bits/stdc++.h" /* #define ONPC */ #define sz(v) ((int)(v.size())) using namespace std; int query(string); string gl(int n, int t) { return string(n, 'a'+t); } int ask(string s, int n) { return query(s + gl(n-sz(s), 0)); } string guess(int n, int s) { string pref; int rem[s]; for (int i = 0; i < s; ++i) rem[i] = query(gl(n,i)); for (int i = 0; i < n; ++i) { int win = -1; for (int j = 0; j < s; ++j) { if (rem[j]) { if (win == -1) win = j; else { if (ask(pref+gl(1,j)+gl(rem[win], win), n) > rem[win] + sz(pref)) win = j; } } } rem[win]--; pref = pref + gl(1,win); } return pref; } #ifdef ONPC int query(string s) { cout << s << endl; int x; cin >> x; return x; } int main() { int n, s; cin >> n >>s; cout << guess(n,s); return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...