結果

問題 No.1557 Binary Variable
ユーザー titiatitia
提出日時 2021-06-25 23:09:07
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 691 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 37,764 KB
最終ジャッジ日時 2023-09-07 14:59:12
合計ジャッジ時間 23,998 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 548 ms
36,344 KB
testcase_01 AC 537 ms
33,296 KB
testcase_02 AC 16 ms
7,868 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 611 ms
35,640 KB
testcase_05 AC 606 ms
35,536 KB
testcase_06 AC 603 ms
34,396 KB
testcase_07 AC 608 ms
35,124 KB
testcase_08 AC 642 ms
37,120 KB
testcase_09 AC 642 ms
37,256 KB
testcase_10 AC 668 ms
37,536 KB
testcase_11 AC 662 ms
37,632 KB
testcase_12 AC 630 ms
36,956 KB
testcase_13 AC 667 ms
37,556 KB
testcase_14 AC 674 ms
37,624 KB
testcase_15 AC 662 ms
37,648 KB
testcase_16 AC 679 ms
37,564 KB
testcase_17 AC 688 ms
37,552 KB
testcase_18 AC 672 ms
37,752 KB
testcase_19 AC 679 ms
37,684 KB
testcase_20 AC 677 ms
37,560 KB
testcase_21 AC 691 ms
37,564 KB
testcase_22 AC 681 ms
37,572 KB
testcase_23 AC 681 ms
37,652 KB
testcase_24 AC 682 ms
37,728 KB
testcase_25 AC 684 ms
37,628 KB
testcase_26 AC 687 ms
37,728 KB
testcase_27 AC 676 ms
37,680 KB
testcase_28 AC 681 ms
37,764 KB
testcase_29 AC 682 ms
37,592 KB
testcase_30 AC 687 ms
37,628 KB
testcase_31 AC 688 ms
37,552 KB
testcase_32 AC 683 ms
37,712 KB
testcase_33 AC 675 ms
37,624 KB
testcase_34 AC 16 ms
7,784 KB
testcase_35 AC 16 ms
7,784 KB
testcase_36 AC 16 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter

N,M=map(int,input().split())
LR=[tuple(map(int,input().split())) for i in range(M)]

LR.sort(key=itemgetter(0))
LR.sort(key=itemgetter(1))

leftmost=-1
ANS=0
for x,y in LR:
    if x>leftmost:
        leftmost=y
        ANS+=1
print(N-ANS)
    
0