# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
152521 | 2019-09-08T09:04:27 Z | ivandasfs | 콤보 (IOI18_combo) | C++14 | 89 ms | 2276 KB |
#include <iostream> #include <algorithm> #include <set> using namespace std; set <char> b; char c[3]; int press(string s); /* string ans = "ABXXY"; int press(string s) { int sol = 0; for (int i=0 ; i<s.size() ; i++) { if (s[i] == ans[0]) { int br = 0; for (int j=0 ; j < ans.size() and i + j < s.size() ; j++) { if (ans[j] == s[i+j]) br++; else break; } sol = max(sol, br); } } return sol; } */ string guess_sequence(int n) { b.insert('A'); b.insert('B'); b.insert('X'); b.insert('Y'); string sol = ""; if (press("AB")) if (press("A")) sol += 'A'; else sol += 'B'; else if (press("C")) sol += 'C'; else sol += 'D'; b.erase(b.find(sol[0])); int i = 0; for (set<char> :: iterator it = b.begin() ; it!=b.end() ; it++) { c[i++] = *it; } for (int i=1 ; i<n-1 ; i++) { int br = press(sol+c[0] + sol+c[1]+c[0] + sol+c[1]+c[1] + sol+c[1]+c[2]); if (br == sol.size() + 0) sol += c[2]; else if (br == sol.size() + 1) sol += c[0]; else sol += c[1]; } if (press(sol+c[0]) == n) sol += c[0]; else if (press(sol+c[1]) == n) sol += c[1]; else sol += c[2]; return sol; } /* int main() { cout <<guess_sequence(5)<<endl; return 0; } */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 300 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 4 ms | 1876 KB | Output is correct |
4 | Correct | 1 ms | 216 KB | Output is correct |
5 | Correct | 2 ms | 356 KB | Output is correct |
6 | Correct | 3 ms | 644 KB | Output is correct |
7 | Correct | 3 ms | 1892 KB | Output is correct |
8 | Correct | 75 ms | 2276 KB | Output is correct |
9 | Correct | 89 ms | 2056 KB | Output is correct |
10 | Correct | 2 ms | 216 KB | Output is correct |
11 | Correct | 3 ms | 488 KB | Output is correct |
12 | Correct | 2 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 428 KB | Output is correct |
14 | Correct | 1 ms | 216 KB | Output is correct |
15 | Correct | 2 ms | 288 KB | Output is correct |
16 | Correct | 2 ms | 216 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Runtime error | 2 ms | 216 KB | Execution failed because the return code was nonzero |
20 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Wrong Answer: wrong guess. |
2 | Halted | 0 ms | 0 KB | - |