提出 #56026902


ソースコード 拡げる

(N,Q),A,*BK = $<.map{|ln| ln.split.map(&:to_i) }
A.sort!
puts BK.map{|b,k|
	(0..10**9).bsearch{|d|
		b0,b1 = b-d,b+d
		i0 = A.bsearch_index{|a| b0<=a }||N
		i1 = A.bsearch_index{|a| b1<a }||N
		# A[i0...i1] が距離 d 以内
		next k<=i1-i0
	}
}

提出情報

提出日時
問題 D - K-th Nearest
ユーザ ds14050
言語 Ruby (ruby 3.2.2)
得点 0
コード長 258 Byte
結果 TLE
実行時間 3220 ms
メモリ 28416 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 425
結果
AC × 3
AC × 14
TLE × 7
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_minmax_00.txt, 02_minmax_01.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 46 ms 16956 KiB
00_sample_01.txt AC 44 ms 17472 KiB
00_sample_02.txt AC 46 ms 17564 KiB
01_random_00.txt AC 861 ms 20892 KiB
01_random_01.txt TLE 3151 ms 26736 KiB
01_random_02.txt AC 2009 ms 24912 KiB
01_random_03.txt TLE 3061 ms 26600 KiB
01_random_04.txt AC 2276 ms 24304 KiB
01_random_05.txt TLE 3072 ms 26788 KiB
01_random_06.txt AC 391 ms 22504 KiB
01_random_07.txt TLE 3051 ms 26728 KiB
01_random_08.txt AC 2214 ms 26124 KiB
01_random_09.txt TLE 3051 ms 26792 KiB
01_random_10.txt AC 371 ms 24412 KiB
01_random_11.txt TLE 3104 ms 26536 KiB
01_random_12.txt AC 2833 ms 25964 KiB
01_random_13.txt TLE 3220 ms 26164 KiB
01_random_14.txt AC 2054 ms 24952 KiB
01_random_15.txt AC 2911 ms 27448 KiB
02_minmax_00.txt AC 46 ms 17240 KiB
02_minmax_01.txt AC 2817 ms 28416 KiB