結果
問題 | No.580 旅館の予約計画 |
ユーザー | mkawa2 |
提出日時 | 2020-01-05 14:30:34 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,096 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 44,848 KB |
最終ジャッジ日時 | 2024-11-22 21:57:53 |
合計ジャッジ時間 | 22,040 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 520 ms
44,468 KB |
testcase_01 | AC | 529 ms
44,468 KB |
testcase_02 | AC | 525 ms
44,460 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 526 ms
44,728 KB |
testcase_06 | AC | 522 ms
44,728 KB |
testcase_07 | AC | 529 ms
44,584 KB |
testcase_08 | AC | 531 ms
44,588 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 529 ms
44,328 KB |
testcase_12 | WA | - |
testcase_13 | AC | 527 ms
44,596 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 672 ms
44,452 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 535 ms
44,604 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 526 ms
44,592 KB |
testcase_27 | AC | 528 ms
44,728 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 525 ms
44,472 KB |
ソースコード
from itertools import * from bisect import * # from math import * from collections import * from heapq import * from random import * from decimal import * import numpy as np import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(0, 1), (1, 0), (0, -1), (-1, 0)] def main(): def stod(s): res=int(s[0])*10000+int(s[2:4])*100+int(s[5:7]) return res n, m = MI() if n > m: print(m) exit() reserve = [] for _ in range(m): s = input() date0=stod(s[:7]) date1=stod(s[8:]) heappush(reserve, [date1,date0]) ans = 0 for _ in range(n): if not reserve:break room=[] pending=[] date1,date0=heappop(reserve) room.append([date1,date0]) checkout=date1 ans+=1 while reserve: date1, date0 = heappop(reserve) if date0>checkout: room.append([date1, date0]) checkout=date1 ans+=1 else: heappush(pending,[date0,date1]) date1,date0=room.pop() heappush(pending, [date0, date1]) if room: checkout=room[-1][0] while pending: date0,date1=heappop(pending) if date0>checkout: break else: heappush(reserve,[date1,date0]) else: heappop(pending) while pending: date0, date1 = heappop(pending) heappush(reserve, [date1, date0]) print(ans) main()