結果
| 問題 |
No.580 旅館の予約計画
|
| ユーザー |
|
| 提出日時 | 2022-03-26 17:07:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-15 08:54:52 |
| 合計ジャッジ時間 | 2,694 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
from bisect import bisect_left
n, m = map(int, input().split())
T = []
for _ in range(m):
fd, ft, td, tt = input().split()
fd = int(fd) - 1
fh, fm = map(int, ft.split(':'))
td = int(td) - 1
th, tm = map(int, tt.split(':'))
f = fd * 24 * 60 + fh * 60 + fm
t = td * 24 * 60 + th * 60 + tm
T.append((f, t))
T.sort(key=lambda x: (x[1], x[0]))
ans = 0
end_times = []
for left, right in T:
idx = bisect_left(end_times, left)
if idx > 0:
del end_times[idx - 1]
end_times.append(right)
ans += 1
elif len(end_times) < n:
end_times.append(right)
ans += 1
print(ans)