結果
| 問題 | No.1767 BLUE to RED |
| コンテスト | |
| ユーザー |
puzneko
|
| 提出日時 | 2022-01-08 01:26:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 257 ms / 2,000 ms |
| コード長 | 539 bytes |
| 記録 | |
| コンパイル時間 | 425 ms |
| コンパイル使用メモリ | 81,896 KB |
| 実行使用メモリ | 122,192 KB |
| 最終ジャッジ日時 | 2024-11-14 09:21:50 |
| 合計ジャッジ時間 | 6,909 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
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))
puzneko