結果

問題 No.1597 Matrix Sort
ユーザー yuruhiyayuruhiya
提出日時 2021-08-19 16:12:39
言語 Crystal
(1.11.2)
結果
AC  
実行時間 473 ms / 1,500 ms
コード長 318 bytes
コンパイル時間 13,167 ms
コンパイル使用メモリ 296,068 KB
実行使用メモリ 423,128 KB
最終ジャッジ日時 2024-04-20 19:06:27
合計ジャッジ時間 23,318 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 416 ms
338,176 KB
testcase_04 AC 467 ms
340,684 KB
testcase_05 AC 444 ms
372,956 KB
testcase_06 AC 421 ms
339,840 KB
testcase_07 AC 420 ms
339,584 KB
testcase_08 AC 394 ms
339,488 KB
testcase_09 AC 401 ms
339,584 KB
testcase_10 AC 388 ms
373,248 KB
testcase_11 AC 410 ms
339,428 KB
testcase_12 AC 32 ms
13,952 KB
testcase_13 AC 65 ms
36,864 KB
testcase_14 AC 419 ms
339,456 KB
testcase_15 AC 31 ms
13,312 KB
testcase_16 AC 74 ms
39,420 KB
testcase_17 AC 432 ms
339,600 KB
testcase_18 AC 414 ms
339,840 KB
testcase_19 AC 473 ms
409,332 KB
testcase_20 AC 364 ms
338,176 KB
testcase_21 AC 373 ms
338,560 KB
testcase_22 AC 431 ms
423,128 KB
testcase_23 AC 447 ms
375,652 KB
testcase_24 AC 22 ms
11,776 KB
testcase_25 AC 18 ms
11,776 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 347 ms
367,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, p = read_line.split.map(&.to_i64)
a = read_line.split.map(&.to_i64)
b = read_line.split.map(&.to_i64)
cnt = [0] * p
a.each { |x| cnt[x] += 1 }
sum = cnt.accumulate(0i64)
puts (0...p).bsearch { |x|
  b.sum { |b|
    val = sum[{p, p - b + x + 1}.min] - sum[p - b]
    x < b ? val : val + sum[x - b + 1]
  } >= k
}
0