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)
for i in range(len(a)):
if i < len(a)//2:
sussies[a[i]-1] = 0
else:
sussies[a[i]-1] = 1
print("! ",end="")
for i in range(n):
print("(" if sussies[i] else ")", end="")
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
18124 KB |
Output is correct |
2 |
Correct |
97 ms |
21440 KB |
Output is correct |
3 |
Correct |
119 ms |
23036 KB |
Output is correct |
4 |
Correct |
107 ms |
23076 KB |
Output is correct |
5 |
Correct |
126 ms |
23104 KB |
Output is correct |
6 |
Correct |
134 ms |
23092 KB |
Output is correct |
7 |
Correct |
138 ms |
22972 KB |
Output is correct |
8 |
Correct |
112 ms |
23076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
18184 KB |
Output is correct |
2 |
Correct |
115 ms |
22892 KB |
Output is correct |
3 |
Correct |
138 ms |
22848 KB |
Output is correct |
4 |
Correct |
111 ms |
22912 KB |
Output is correct |
5 |
Correct |
135 ms |
23056 KB |
Output is correct |
6 |
Correct |
113 ms |
23080 KB |
Output is correct |
7 |
Correct |
114 ms |
23132 KB |
Output is correct |
8 |
Correct |
113 ms |
23160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18116 KB |
Output is correct |
2 |
Correct |
923 ms |
28084 KB |
Output is correct |
3 |
Correct |
1298 ms |
28900 KB |
Output is correct |
4 |
Correct |
1451 ms |
29068 KB |
Output is correct |
5 |
Correct |
1483 ms |
29108 KB |
Output is correct |
6 |
Correct |
1583 ms |
29060 KB |
Output is correct |
7 |
Correct |
1498 ms |
28444 KB |
Output is correct |
8 |
Correct |
1632 ms |
29452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
37 ms |
18120 KB |
Output is correct |
2 |
Correct |
1694 ms |
32132 KB |
Output is correct |
3 |
Correct |
1680 ms |
28672 KB |
Output is correct |
4 |
Correct |
1611 ms |
29436 KB |
Output is correct |
5 |
Correct |
1514 ms |
28644 KB |
Output is correct |
6 |
Correct |
1628 ms |
28928 KB |
Output is correct |
7 |
Correct |
1488 ms |
29084 KB |
Output is correct |
8 |
Correct |
1448 ms |
29484 KB |
Output is correct |