結果

問題 No.274 The Wall
ユーザー yuruhiyayuruhiya
提出日時 2020-09-16 22:05:33
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 314 bytes
コンパイル時間 21,105 ms
コンパイル使用メモリ 254,180 KB
実行使用メモリ 4,880 KB
最終ジャッジ日時 2023-09-13 12:06:34
合計ジャッジ時間 18,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,552 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,396 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 22 ms
4,780 KB
testcase_12 AC 3 ms
4,824 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 3 ms
4,524 KB
testcase_16 AC 9 ms
4,748 KB
testcase_17 AC 8 ms
4,796 KB
testcase_18 AC 8 ms
4,728 KB
testcase_19 WA -
testcase_20 AC 3 ms
4,772 KB
testcase_21 WA -
testcase_22 AC 3 ms
4,828 KB
testcase_23 AC 4 ms
4,788 KB
testcase_24 AC 3 ms
4,684 KB
testcase_25 AC 3 ms
4,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = read_line.split.map &.to_i
cnt = [0] * (m.succ // 2)
n.times do
  l, r = read_line.split.map &.to_i
  (l..r).each do |i|
    cnt[i < cnt.size ? i : cnt.size - i - 1 - m % 2] += 1
  end
end
puts cnt.each_with_index.all? { |(v, i)|
  if m.odd? && i != m//2
    v <= 1
  else
    v <= 2
  end
} ? "YES" : "NO"
0