# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114097 |
2019-05-30T08:39:09 Z |
Alexa2001 |
Combo (IOI18_combo) |
C++17 |
|
2 ms |
256 KB |
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
int ask1, ask2, ask3, ask4;
char a, b, c, d;
ask1 = press("AB");
ask2 = (!ask1);
ask3 = press("AX");
ask4 = (!ask3);
if(ask1 && ask3) a = 'A', b = 'B', c = 'X', d = 'Y';
else if(ask1 && ask4) a = 'B', b = 'A', c = 'X', d = 'Y';
else if(ask2 && ask3) a = 'X', b = 'A', c = 'B', d = 'Y';
else a = 'Y', b = 'A', c = 'B', d = 'X';
string S;
S.push_back(a);
string s1, s2, s3, s4;
s1.push_back(b);
s2.push_back(c); s2.push_back(b);
s3.push_back(c); s3.push_back(c);
s4.push_back(c); s4.push_back(d);
string p;
while(S.size() + 2 <= N)
{
p = S + s1 + S + s2 + S + s3 + S + s4;
assert(p.size() <= 4 * N);
int coins = press(p);
if(coins == S.size() + 1)
S.push_back(b);
else if(coins == S.size() + 2)
S.push_back(c);
else S.push_back(d);
}
p = S; p.push_back(b);
if(press(p) == N) return p;
p = S; p.push_back(c);
if(press(p) == N) return p;
p = S; p.push_back(d);
return p;
}
Compilation message
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
34 | while(S.size() + 2 <= N)
| ~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/10/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
from combo.cpp:2:
combo.cpp:37:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
37 | assert(p.size() <= 4 * N);
| ~~~~~~~~~^~~~~~~~
combo.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | if(coins == S.size() + 1)
| ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | else if(coins == S.size() + 2)
| ~~~~~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
2 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
200 KB |
Output is correct |
16 |
Correct |
1 ms |
200 KB |
Output is correct |
17 |
Correct |
1 ms |
200 KB |
Output is correct |
18 |
Correct |
1 ms |
200 KB |
Output is correct |
19 |
Correct |
1 ms |
200 KB |
Output is correct |
20 |
Correct |
1 ms |
200 KB |
Output is correct |
21 |
Correct |
1 ms |
236 KB |
Output is correct |
22 |
Correct |
1 ms |
200 KB |
Output is correct |
23 |
Correct |
1 ms |
200 KB |
Output is correct |
24 |
Correct |
1 ms |
200 KB |
Output is correct |
25 |
Correct |
1 ms |
200 KB |
Output is correct |
26 |
Correct |
1 ms |
200 KB |
Output is correct |
27 |
Correct |
1 ms |
200 KB |
Output is correct |
28 |
Correct |
1 ms |
200 KB |
Output is correct |
29 |
Correct |
1 ms |
200 KB |
Output is correct |
30 |
Correct |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
1 ms |
200 KB |
Output is correct |
33 |
Correct |
1 ms |
200 KB |
Output is correct |
34 |
Correct |
1 ms |
200 KB |
Output is correct |
35 |
Correct |
1 ms |
200 KB |
Output is correct |
36 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Wrong Answer: wrong guess. |
2 |
Halted |
0 ms |
0 KB |
- |