結果
問題 | No.2978 Lexicographically Smallest and Largest Subarray |
ユーザー |
![]() |
提出日時 | 2024-12-04 14:38:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,059 bytes |
コンパイル時間 | 439 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 92,896 KB |
平均クエリ数 | 1501.00 |
最終ジャッジ日時 | 2024-12-04 14:38:44 |
合計ジャッジ時間 | 22,343 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 57 |
ソースコード
'''from random import randintN = 3Q = 15#L = [randint(1,N) for _ in range(N)]#L0 = [1,2,3,4,5,6,7,8,9,10]L0 = [1,10,9,8,7,6,5,4,3,2]L0 = [2,3,1]def check0(l0,r0,l1,r1):print("?",l0,r0,l1,r1)global L0return L0[l0-1:r0] < L0[l1-1:r1]'''N, Q = map(int, input().split())def check(l0, r0, l1, r1):print("?", l0, r0, l1, r1)x = int(input())if x == -1:exit()return x == 1L = list(range(1, N + 1))while len(L) > 1:L2 = []while L:x = L.pop()if L:y = L.pop()if check(x, x, y, y):L2.append(x)else:L2.append(y)else:L2.append(x)L = L2[:]ans = [L[0], L[0]]L = list(range(1, N + 1))while len(L) > 1:L2 = []while L:x = L.pop()if L:y = L.pop()if check(x, N, y, N):L2.append(y)else:L2.append(x)else:L2.append(x)L = L2[:]ans += [L[0], N]print("!", *ans)