結果

問題 No.1995 CHIKA Road
ユーザー DrDrpilotDrDrpilot
提出日時 2022-07-02 13:05:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 622 ms
コンパイル使用メモリ 87,364 KB
実行使用メモリ 90,960 KB
最終ジャッジ日時 2023-08-18 03:58:49
合計ジャッジ時間 9,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,452 KB
testcase_01 AC 71 ms
71,060 KB
testcase_02 AC 71 ms
71,116 KB
testcase_03 AC 73 ms
71,532 KB
testcase_04 AC 71 ms
71,456 KB
testcase_05 AC 72 ms
71,076 KB
testcase_06 AC 110 ms
77,972 KB
testcase_07 AC 145 ms
79,892 KB
testcase_08 AC 75 ms
71,444 KB
testcase_09 AC 75 ms
71,348 KB
testcase_10 AC 251 ms
88,192 KB
testcase_11 AC 274 ms
87,896 KB
testcase_12 AC 186 ms
87,080 KB
testcase_13 AC 152 ms
79,860 KB
testcase_14 AC 159 ms
80,232 KB
testcase_15 AC 259 ms
86,148 KB
testcase_16 AC 124 ms
77,852 KB
testcase_17 AC 206 ms
84,124 KB
testcase_18 AC 274 ms
88,372 KB
testcase_19 AC 270 ms
88,424 KB
testcase_20 AC 190 ms
82,036 KB
testcase_21 AC 181 ms
82,148 KB
testcase_22 AC 277 ms
90,960 KB
testcase_23 AC 149 ms
79,784 KB
testcase_24 AC 250 ms
86,296 KB
testcase_25 AC 128 ms
78,112 KB
testcase_26 AC 159 ms
80,008 KB
testcase_27 AC 237 ms
86,352 KB
testcase_28 AC 177 ms
82,120 KB
testcase_29 AC 267 ms
88,416 KB
testcase_30 AC 123 ms
78,036 KB
testcase_31 AC 112 ms
77,740 KB
testcase_32 AC 136 ms
79,708 KB
testcase_33 AC 239 ms
86,748 KB
testcase_34 AC 112 ms
77,740 KB
testcase_35 AC 150 ms
79,944 KB
testcase_36 AC 163 ms
80,148 KB
testcase_37 AC 272 ms
88,156 KB
testcase_38 AC 213 ms
83,760 KB
testcase_39 AC 114 ms
77,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
p=[list(map(int,input().split())) for _ in range(m)]
p.sort(key=lambda x:x[1])
now=1;cost=0
for a,b in p:
    if now>a:
        continue
    cost+=(a-now)*2
    cost+=(b-a)*2-1
    now=b
print(cost+(n-now)*2)
0