結果
問題 | No.2978 Lexicographically Smallest and Largest Subarray |
ユーザー |
|
提出日時 | 2024-12-14 20:54:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 306 ms / 2,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 82,284 KB |
実行使用メモリ | 89,408 KB |
平均クエリ数 | 1499.00 |
最終ジャッジ日時 | 2024-12-14 20:55:14 |
合計ジャッジ時間 | 19,753 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 57 |
ソースコード
N, Q = map(int, input().split())small = []large = []for i in range(N//2):l1 = 2*i+1l2 = 2*i+2r = Nprint(f'? {l1} {r} {l2} {r}')x = int(input())if x == 1:small.append(l1-1)large.append(l2-1)else:small.append(l2-1)large.append(l1-1)imin = small[0]for item in small[1:]:l1 = iminl2 = itemprint(f'? {l1+1} {l1+1} {l2+1} {l2+1}')x = int(input())if x == 0:imin = itemimax = large[0]for item in large[1:]:l1 = imaxl2 = itemprint(f'? {l1+1} {N} {l2+1} {N}')x = int(input())if x == 1:imax = itemprint(f'! {imin+1} {imin+1} {imax+1} {N}')