結果

問題 No.2978 Lexicographically Smallest and Largest Subarray
ユーザー hiro1729
提出日時 2024-12-02 20:04:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 633 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 92,620 KB
平均クエリ数 1499.00
最終ジャッジ日時 2024-12-02 20:04:42
合計ジャッジ時間 22,477 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

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_max, N, now_min, now_min, flush = True)
0