Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import stdout
- T = int(input())
- while T > 0:
- T -= 1
- n = int(input())
- arr = list(map(int, input().split()))
- pfs = [0]*1
- for x in arr:
- pfs.append(pfs[-1]+x)
- l, r = 1, n
- while l < r:
- m = (l+r) // 2
- print("?", m, end = " ")
- for i in range(l, m+1):
- print(i, end = " ")
- print()
- stdout.flush()
- rps = int(input())
- if rps == pfs[m] - pfs[l-1]:
- l = m+1
- else:
- r = m
- print("!", l, end = "\n")
- stdout.flush()
Advertisement
Add Comment
Please, Sign In to add comment