結果
問題 |
No.2978 Lexicographically Smallest and Largest Subarray
|
ユーザー |
![]() |
提出日時 | 2024-12-04 07:00:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 299 ms / 2,000 ms |
コード長 | 431 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 90,700 KB |
平均クエリ数 | 1499.00 |
最終ジャッジ日時 | 2024-12-04 07:01:22 |
合計ジャッジ時間 | 19,261 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 57 |
ソースコード
N, Q = map(int, input().split()) X = [] for i in range(1, 1000, 2): print('?', i, N, i + 1, N) f = int(input()) if f: X.append((i, i + 1)) else: X.append((i + 1, i)) while len(X) > 1: m, M = X.pop() mm, MM = X.pop() print('?', m, N, mm, N) f = int(input()) if f == 0: m = mm print('?', M, N, MM, N) f = int(input()) if f: M = MM X.append((m, M)) l, ll = X.pop() print('!', l, l, ll, N)