# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
312399 |
2020-10-13T06:04:15 Z |
Karliver |
Combo (IOI18_combo) |
C++14 |
|
0 ms |
0 KB |
#include "combo.h>
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string ans = "";
char a, b, x ,y;
if(press("AB")) {
x = 'X';
y = 'Y';
(press("A") ? (a = 'A', b = 'B') : (a = 'B', b = 'A'));
}
else {
x = 'A';
y = 'B';
(press("X") ? (a = 'X', b = 'Y') : (a = 'Y', b = 'X'));
}
ans += a;
if(N == 1) {
return ans;
}
for(int i = 1;i <= N - 2;++i) {
string cur = ans + b + b + ans + x + ans + b + y + ans + b + x;
int j = press(cur);
if(j == i)ans += y;
else if(j == i + 1)ans += x;
else ans += b;
}
if(press(ans + b) == N)ans += b;
else if(press(ans + x) == N)ans += x;
else ans += y;
return ans;
}
Compilation message
combo.cpp:1:10: warning: missing terminating " character
1 | #include "combo.h>
| ^
combo.cpp:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include "combo.h>
| ^~~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:12: error: 'press' was not declared in this scope
9 | if(press("AB")) {
| ^~~~~
combo.cpp:25:21: error: 'press' was not declared in this scope
25 | int j = press(cur);
| ^~~~~
combo.cpp:30:8: error: 'press' was not declared in this scope
30 | if(press(ans + b) == N)ans += b;
| ^~~~~