結果

問題 No.1557 Binary Variable
ユーザー RustyRusty
提出日時 2023-01-04 13:01:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,098 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 38,696 KB
最終ジャッジ日時 2023-08-18 11:09:02
合計ジャッジ時間 36,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 676 ms
38,016 KB
testcase_01 AC 647 ms
34,972 KB
testcase_02 AC 14 ms
7,768 KB
testcase_03 AC 14 ms
7,768 KB
testcase_04 AC 853 ms
36,504 KB
testcase_05 AC 847 ms
36,320 KB
testcase_06 AC 823 ms
35,404 KB
testcase_07 AC 832 ms
35,968 KB
testcase_08 AC 967 ms
37,980 KB
testcase_09 AC 977 ms
38,092 KB
testcase_10 AC 1,065 ms
38,388 KB
testcase_11 AC 1,034 ms
38,536 KB
testcase_12 AC 972 ms
37,920 KB
testcase_13 AC 1,054 ms
38,492 KB
testcase_14 AC 1,067 ms
38,560 KB
testcase_15 AC 1,066 ms
38,488 KB
testcase_16 AC 1,067 ms
38,560 KB
testcase_17 AC 1,066 ms
38,564 KB
testcase_18 AC 1,070 ms
38,604 KB
testcase_19 AC 1,081 ms
38,632 KB
testcase_20 AC 1,080 ms
38,508 KB
testcase_21 AC 1,059 ms
38,568 KB
testcase_22 AC 1,055 ms
38,504 KB
testcase_23 AC 1,078 ms
38,496 KB
testcase_24 AC 1,075 ms
38,580 KB
testcase_25 AC 1,078 ms
38,620 KB
testcase_26 AC 1,079 ms
38,576 KB
testcase_27 AC 1,080 ms
38,576 KB
testcase_28 AC 1,078 ms
38,696 KB
testcase_29 AC 1,081 ms
38,580 KB
testcase_30 AC 1,070 ms
38,556 KB
testcase_31 AC 1,096 ms
38,628 KB
testcase_32 AC 1,098 ms
38,580 KB
testcase_33 AC 1,094 ms
38,580 KB
testcase_34 AC 15 ms
7,800 KB
testcase_35 AC 14 ms
7,848 KB
testcase_36 AC 15 ms
7,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
L = []
for i in range(m):
    l,r = map(int,input().split())
    L.append([r,l])
L.sort()
ans = n
r = 0
if m != 1:
    while L[r+1][1] <= L[0][0]:
        r += 1
        if r == m-1:
            break
    ans -= 1

    for i in range(1,m):
        if i <= r:
            continue
        if r != m-1:
            while L[r+1][1] <= L[i][0]:
                r += 1
                if r == m-1:
                    break
            ans -= 1

else:
    ans = n-1
    
print(ans)
0