結果

問題 No.580 旅館の予約計画
ユーザー wajima_wataruwajima_wataru
提出日時 2018-01-04 21:31:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 579 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 9,492 KB
最終ジャッジ日時 2023-08-24 19:02:39
合計ジャッジ時間 3,043 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,136 KB
testcase_01 AC 27 ms
9,176 KB
testcase_02 AC 26 ms
9,296 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 27 ms
9,192 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 32 ms
9,256 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 25 ms
9,176 KB
testcase_27 AC 26 ms
9,092 KB
testcase_28 AC 26 ms
9,132 KB
testcase_29 AC 25 ms
9,104 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 25 ms
9,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
import heapq

N, M = map(int, input().split())
R = []
for _ in range(M):
    d_in, h_in, m_in, d_out, h_out, m_out = map(int, re.split('[ :]', input()))
    R.append([d_in * 1440 + h_in * 60 + m_in, d_out * 1440 + h_out * 60 + m_out])
R.sort(key=lambda x: x[1])
R.sort(key=lambda x: x[0])
pendings = []
count = 0
for r in R:
    heapq.heappush(pendings, (r[1], r[0]))
    while pendings[0][0] < r[0]:
        heapq.heappop(pendings)
        count += 1
    if len(pendings) > N:
        pendings.pop()
        heapq.heapify(pendings)
count += len(pendings)
print(count)
0