結果

問題 No.1557 Binary Variable
ユーザー simansiman
提出日時 2021-07-04 18:47:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 626 ms / 2,000 ms
コード長 197 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 11,408 KB
実行使用メモリ 34,044 KB
最終ジャッジ日時 2023-09-14 00:40:26
合計ジャッジ時間 25,697 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 571 ms
32,008 KB
testcase_01 AC 542 ms
32,088 KB
testcase_02 AC 83 ms
14,996 KB
testcase_03 AC 73 ms
15,148 KB
testcase_04 AC 553 ms
33,524 KB
testcase_05 AC 611 ms
33,588 KB
testcase_06 AC 572 ms
33,676 KB
testcase_07 AC 584 ms
33,424 KB
testcase_08 AC 581 ms
33,476 KB
testcase_09 AC 590 ms
33,624 KB
testcase_10 AC 605 ms
33,416 KB
testcase_11 AC 604 ms
33,460 KB
testcase_12 AC 612 ms
33,624 KB
testcase_13 AC 602 ms
33,384 KB
testcase_14 AC 591 ms
33,484 KB
testcase_15 AC 585 ms
33,556 KB
testcase_16 AC 607 ms
33,516 KB
testcase_17 AC 607 ms
33,424 KB
testcase_18 AC 587 ms
33,376 KB
testcase_19 AC 588 ms
33,728 KB
testcase_20 AC 569 ms
33,468 KB
testcase_21 AC 581 ms
33,640 KB
testcase_22 AC 584 ms
33,956 KB
testcase_23 AC 591 ms
33,536 KB
testcase_24 AC 594 ms
33,908 KB
testcase_25 AC 603 ms
33,832 KB
testcase_26 AC 588 ms
33,800 KB
testcase_27 AC 591 ms
33,668 KB
testcase_28 AC 597 ms
33,848 KB
testcase_29 AC 626 ms
34,044 KB
testcase_30 AC 599 ms
33,960 KB
testcase_31 AC 606 ms
33,828 KB
testcase_32 AC 602 ms
33,888 KB
testcase_33 AC 584 ms
33,768 KB
testcase_34 AC 79 ms
15,172 KB
testcase_35 AC 75 ms
15,180 KB
testcase_36 AC 77 ms
15,040 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
Q = M.times.map { gets.split.map(&:to_i) }.sort_by { |s, t| t }
ans = N
last = -1

Q.each do |s, t|
  next if (s..t).cover?(last)

  last = t
  ans -= 1
end

puts ans
0