結果

問題 No.1557 Binary Variable
ユーザー uir0uir0
提出日時 2021-06-25 23:03:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 37,772 KB
最終ジャッジ日時 2023-09-07 14:56:41
合計ジャッジ時間 13,085 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 228 ms
36,356 KB
testcase_01 AC 221 ms
33,176 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 AC 16 ms
7,868 KB
testcase_04 AC 271 ms
35,644 KB
testcase_05 AC 271 ms
35,580 KB
testcase_06 AC 260 ms
34,468 KB
testcase_07 AC 270 ms
35,024 KB
testcase_08 AC 297 ms
37,088 KB
testcase_09 AC 302 ms
37,324 KB
testcase_10 AC 322 ms
37,592 KB
testcase_11 AC 324 ms
37,504 KB
testcase_12 AC 293 ms
37,012 KB
testcase_13 AC 317 ms
37,656 KB
testcase_14 AC 329 ms
37,628 KB
testcase_15 AC 321 ms
37,528 KB
testcase_16 AC 335 ms
37,584 KB
testcase_17 AC 335 ms
37,620 KB
testcase_18 AC 334 ms
37,684 KB
testcase_19 AC 334 ms
37,700 KB
testcase_20 AC 330 ms
37,612 KB
testcase_21 AC 331 ms
37,572 KB
testcase_22 AC 332 ms
37,756 KB
testcase_23 AC 335 ms
37,688 KB
testcase_24 AC 341 ms
37,564 KB
testcase_25 AC 341 ms
37,704 KB
testcase_26 AC 341 ms
37,764 KB
testcase_27 AC 336 ms
37,632 KB
testcase_28 AC 333 ms
37,636 KB
testcase_29 AC 333 ms
37,740 KB
testcase_30 AC 340 ms
37,592 KB
testcase_31 AC 336 ms
37,696 KB
testcase_32 AC 337 ms
37,772 KB
testcase_33 AC 338 ms
37,568 KB
testcase_34 AC 16 ms
7,880 KB
testcase_35 AC 16 ms
7,968 KB
testcase_36 AC 16 ms
7,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
input = sys.stdin.readline  # "\n"を含む

def solve(N, M, sect):
    sect.sort(key = itemgetter(1))
    temp = 0
    z = 0
    for s in sect:
        if temp < s[0]:
            temp = s[1]
            z += 1

    return N - z

def main():
    N, M = map(int, input().split())
    sect = [tuple(map(int, input().split())) for _ in range(M)]
    res = solve(N, M, sect)
    print(res)

if __name__ == "__main__":
    main()
0