結果

問題 No.1557 Binary Variable
ユーザー 👑 H20H20
提出日時 2021-06-25 23:17:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 430 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 102,072 KB
最終ジャッジ日時 2023-09-07 15:02:34
合計ジャッジ時間 15,778 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
97,996 KB
testcase_01 AC 225 ms
97,920 KB
testcase_02 AC 68 ms
71,344 KB
testcase_03 AC 69 ms
71,472 KB
testcase_04 AC 328 ms
100,600 KB
testcase_05 AC 326 ms
100,616 KB
testcase_06 AC 317 ms
102,072 KB
testcase_07 AC 323 ms
101,404 KB
testcase_08 AC 379 ms
99,220 KB
testcase_09 AC 395 ms
99,184 KB
testcase_10 AC 408 ms
98,940 KB
testcase_11 AC 408 ms
98,932 KB
testcase_12 AC 372 ms
99,312 KB
testcase_13 AC 408 ms
99,044 KB
testcase_14 AC 420 ms
98,928 KB
testcase_15 AC 417 ms
98,896 KB
testcase_16 AC 419 ms
98,884 KB
testcase_17 AC 423 ms
98,928 KB
testcase_18 AC 423 ms
99,096 KB
testcase_19 AC 421 ms
98,920 KB
testcase_20 AC 423 ms
99,088 KB
testcase_21 AC 414 ms
98,928 KB
testcase_22 AC 428 ms
99,104 KB
testcase_23 AC 422 ms
99,028 KB
testcase_24 AC 424 ms
99,036 KB
testcase_25 AC 424 ms
99,044 KB
testcase_26 AC 428 ms
98,932 KB
testcase_27 AC 424 ms
99,328 KB
testcase_28 AC 419 ms
99,260 KB
testcase_29 AC 430 ms
99,120 KB
testcase_30 AC 428 ms
98,920 KB
testcase_31 AC 430 ms
98,900 KB
testcase_32 AC 430 ms
98,928 KB
testcase_33 AC 422 ms
98,968 KB
testcase_34 AC 69 ms
71,348 KB
testcase_35 AC 68 ms
71,512 KB
testcase_36 AC 69 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int, input().split())
L = [[0] * 2 for i in range(M)]
for i in range(M):
    L[i][0],L[i][1]=map(int, input().split())
L = sorted(L, key=lambda x: x[1])  #[1]に注目してソート
ans = N
temp = -1
for lr in L:
    l=lr[0]
    r=lr[1]
    if temp<l:
        temp=r
        ans-=1
print(ans)

0