結果

問題 No.2978 Lexicographically Smallest and Largest Subarray
ユーザー hirayuu_yc
提出日時 2024-12-02 14:52:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 89,952 KB
平均クエリ数 1501.00
最終ジャッジ日時 2024-12-02 14:52:50
合計ジャッジ時間 22,343 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int,input().split())
small=[]
large=[]
for i in range(0,N,2):
	print("?",i+1,N,i+2,N)
	res=input()
	if res=="0":
		large.append(i+1)
		small.append(i+2)
	else:
		large.append(i+2)
		small.append(i+1)
sm=small[0]
for i in small:
	print("?",sm,N,i,N)
	res=input()
	if res=="0":
		sm=i
la=large[0]
for i in large:
	print("?",la,N,i,N)
	res=input()
	if res=="1":
		la=i
print("!",sm,sm,la,N)
0