結果
| 問題 | No.580 旅館の予約計画 |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-28 01:36:36 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 839 bytes |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-13 16:12:30 |
| 合計ジャッジ時間 | 2,278 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter
from bisect import bisect_left
# %%
N, M = map(int, readline().split())
lines = readlines()
# %%
LR = []
for line in lines:
day1, hm1, day2, hm2 = line.split()
h1, m1 = hm1.split(b':')
h2, m2 = hm2.split(b':')
L = int(day1) * 1440 + int(h1) * 60 + int(m1)
R = int(day2) * 1440 + int(h2) * 60 + int(m2)
LR.append((L, R))
LR.sort(key=itemgetter(1))
# %%
answer = 0
end_times = []
for L, R in LR:
i = bisect_left(end_times, L)
if i:
del end_times[i - 1]
end_times.append(R)
answer += 1
elif len(end_times) < N:
end_times.append(R)
answer += 1
continue
# %%
print(answer)
# %%
maspy