# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
958104 |
2024-04-04T23:35:18 Z |
Pring |
Combo (IOI18_combo) |
C++17 |
|
1 ms |
596 KB |
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
// #define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
namespace {
char GET2(string p) {
if (press(p + 'A' + p + 'B') > p.size()) return (press(p + 'A') > p.size() ? 'A' : 'B');
return (press(p + 'X') > p.size() ? 'X' : 'Y');
}
char GET3(string p, char disable) {
char a = 'B', b = 'X', c = 'Y';
if (disable == 'B') a = 'A';
if (disable == 'X') b = 'A';
if (disable == 'Y') c = 'A';
if (press(p + a + p + b) > p.size()) return (press(p + a) > p.size() ? a : b);
return c;
}
char GET(string p, char disable) {
char a = 'B', b = 'X', c = 'Y';
if (disable == 'B') a = 'A';
if (disable == 'X') b = 'A';
if (disable == 'Y') c = 'A';
int x = press(p + a + a + p + a + b + p + a + c + p + b);
if (x == p.size() + 2) return a;
if (x == p.size() + 1) return b;
return c;
}
}
string guess_sequence(int n) {
string ans = "";
ans.push_back(GET2(ans));
FOR(i, 1, n - 1) ans.push_back(GET(ans, ans[0]));
ans.push_back(GET3(ans, ans[0]));
return ans;
}
Compilation message
combo.cpp: In function 'char {anonymous}::GET2(std::string)':
combo.cpp:25:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | if (press(p + 'A' + p + 'B') > p.size()) return (press(p + 'A') > p.size() ? 'A' : 'B');
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:25:73: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | if (press(p + 'A' + p + 'B') > p.size()) return (press(p + 'A') > p.size() ? 'A' : 'B');
| ~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:26:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | return (press(p + 'X') > p.size() ? 'X' : 'Y');
| ~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp: In function 'char {anonymous}::GET3(std::string, char)':
combo.cpp:34:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | if (press(p + a + p + b) > p.size()) return (press(p + a) > p.size() ? a : b);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:34:67: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | if (press(p + a + p + b) > p.size()) return (press(p + a) > p.size() ? a : b);
| ~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp: In function 'char {anonymous}::GET(std::string, char)':
combo.cpp:44:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | if (x == p.size() + 2) return a;
| ~~^~~~~~~~~~~~~~~
combo.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | if (x == p.size() + 1) return b;
| ~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
512 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer: wrong guess. |
2 |
Halted |
0 ms |
0 KB |
- |