結果

問題 No.580 旅館の予約計画
ユーザー titia
提出日時 2026-02-15 03:15:44
言語 PyPy3
(7.3.17)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 554 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 246 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 66,252 KB
最終ジャッジ日時 2026-02-15 03:15:48
合計ジャッジ時間 3,865 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

from operator import itemgetter

n,m=list(map(int,input().split()))

A=[]
for i in range(m):
    x,y,z,w=input().split()
    x=int(x)
    y1,y2=y.split(":")
    y1=int(y1)
    y2=int(y2)

    a=x*1440+y1*60+y2

    z=int(z)
    w1,w2=w.split(":")
    w1=int(w1)
    w2=int(w2)

    b=z*1440+w1*60+w2

    A.append((a,b))

A.sort(key=itemgetter(1))
B=[0]*n
ANS=0

for a,b in A:
    B.sort(reverse=True)
    for i in range(n):
        if B[i]<=a:
            ANS+=1
            B[i]=b+1
            break

print(ANS)
0