結果
問題 | No.2978 Lexicographically Smallest and Largest Subarray |
ユーザー |
|
提出日時 | 2024-12-02 20:06:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 308 ms / 2,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 91,028 KB |
平均クエリ数 | 1499.00 |
最終ジャッジ日時 | 2024-12-02 20:06:55 |
合計ジャッジ時間 | 19,806 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 57 |
ソースコード
N, Q = map(int, input().split()) mins = [] maxs = [] for i in range(N // 2): print('?', 2 * i + 1, 2 * i + 1, 2 * i + 2, 2 * i + 2, flush = True) if input() == '1': mins.append(2 * i + 1) maxs.append(2 * i + 2) else: mins.append(2 * i + 2) maxs.append(2 * i + 1) # ここまで500回 now_min = mins[0] for i in mins[1:]: print('?', i, i, now_min, now_min, flush = True) if input() == '1': now_min = i # ここまで999回 now_max = maxs[0] for i in maxs[1:]: print('?', now_max, N, i, N, flush = True) if input() == '1': now_max = i # ここまで1498回 print('!', now_min, now_min, now_max, N, flush = True)