結果
問題 |
No.2978 Lexicographically Smallest and Largest Subarray
|
ユーザー |
|
提出日時 | 2024-12-14 20:52:46 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 683 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 94,020 KB |
平均クエリ数 | 807.58 |
最終ジャッジ日時 | 2024-12-14 20:53:06 |
合計ジャッジ時間 | 18,432 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 RE * 56 |
ソースコード
N, Q = map(int, input().split()) small = [] large = [] for i in range(N//2): l1 = 2*i+1 l2 = 2*i+2 r = N print(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: l1 = small[imin] l2 = item print(f'? {l1+1} {l1+1} {l2+1} {l2+1}') x = int(input()) if x == 0: imin = item imax = large[0] for item in large: l1 = large[imax] l2 = item print(f'? {l1+1} {N} {l2+1} {N}') x = int(input()) if x == 1: imax = item print(f'! {imin+1} {imin+1} {imax+1} {N}')