結果

問題 No.1767 BLUE to RED
ユーザー puznekopuzneko
提出日時 2022-01-08 01:26:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 122,112 KB
最終ジャッジ日時 2024-04-26 19:09:57
合計ジャッジ時間 7,004 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 36 ms
52,352 KB
testcase_03 AC 38 ms
51,968 KB
testcase_04 AC 40 ms
52,608 KB
testcase_05 AC 44 ms
53,120 KB
testcase_06 AC 41 ms
51,840 KB
testcase_07 AC 47 ms
59,136 KB
testcase_08 AC 48 ms
60,032 KB
testcase_09 AC 192 ms
108,312 KB
testcase_10 AC 213 ms
117,380 KB
testcase_11 AC 195 ms
115,424 KB
testcase_12 AC 182 ms
108,768 KB
testcase_13 AC 228 ms
120,924 KB
testcase_14 AC 262 ms
121,768 KB
testcase_15 AC 261 ms
121,636 KB
testcase_16 AC 259 ms
121,516 KB
testcase_17 AC 259 ms
122,112 KB
testcase_18 AC 252 ms
121,768 KB
testcase_19 AC 263 ms
121,596 KB
testcase_20 AC 259 ms
121,632 KB
testcase_21 AC 257 ms
121,972 KB
testcase_22 AC 258 ms
121,380 KB
testcase_23 AC 263 ms
121,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [int(x) for x in stdin.readline().rstrip().split()]

ab = []
for x in a:
    ab.append((x,0))
for x in b:
    ab.append((x,1))

ab.append((-10**10,0))
ab.append((10**10,0))
ab.sort()

ans = 2*10**10 - 1 - n

l = len(ab)
rangemax = 0
for i in range(1,l):
    rangemax = max(rangemax,ab[i][0]-ab[i-1][0])
    if ab[i][1] == 0:
        ans -= rangemax - 1
        rangemax = 0

print("{}".format(ans))
0