import sys
n,q = map(int, input().split())
a = []
sussies = [0 for i in range(n+1)]
for i in range(1, n+1):
if len(a)==0:
a.append(i)
continue
print("?",a[-1],i),sys.stdout.flush()
if int(input()):
sussies[a.pop()-1] = 1
sussies[i-1] = 0
else:
a.append(i)
print("! ",end="")
for i in range(n):
print("(" if sussies[i] else ")", end="")
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
18184 KB |
Output is correct |
2 |
Correct |
86 ms |
21668 KB |
Output is correct |
3 |
Correct |
151 ms |
22772 KB |
Output is correct |
4 |
Correct |
130 ms |
23288 KB |
Output is correct |
5 |
Correct |
124 ms |
22808 KB |
Output is correct |
6 |
Correct |
123 ms |
22872 KB |
Output is correct |
7 |
Correct |
114 ms |
22868 KB |
Output is correct |
8 |
Correct |
142 ms |
22944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
18124 KB |
Mismatch at position 2. Expected (, found ) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18192 KB |
Output is correct |
2 |
Correct |
717 ms |
28668 KB |
Output is correct |
3 |
Correct |
1393 ms |
29236 KB |
Output is correct |
4 |
Correct |
1547 ms |
29096 KB |
Output is correct |
5 |
Correct |
1539 ms |
29172 KB |
Output is correct |
6 |
Correct |
1607 ms |
29240 KB |
Output is correct |
7 |
Correct |
1408 ms |
28436 KB |
Output is correct |
8 |
Correct |
1535 ms |
29556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
18216 KB |
Mismatch at position 3. Expected (, found ) |
2 |
Halted |
0 ms |
0 KB |
- |