結果

問題 No.580 旅館の予約計画
ユーザー superzugansuperzugan
提出日時 2021-05-11 00:24:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 2,224 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 12,196 KB
実行使用メモリ 10,712 KB
最終ジャッジ日時 2023-10-20 09:47:41
合計ジャッジ時間 2,642 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def hizuke(s,t): #日数を1日加算
    t+=1
    # print(t)
    t=list(map(int,list(str(t))))
    # print(t)

    if t[2]==6 and t[3]==0:
        t[2]=0
        t[3]=0
        t[1]+=1
        # t =int("".join(str(t)))
    if t[0]==2 and t[1]==4:
        t[0]=0
        t[1]=0
        s+=1
    t=list(map(str,t))
    t="".join(t)
    t=int(t)
    return (s,t)
n,m=map(int,input().split())
lst=[]
for i in range(m):
    d,a,o,b=map(str,input().split())
    d=int(d)
    o=int(o)
    x=int(a[:2])*100+int(a[3:])
    y=int(b[:2])*100+int(b[3:])
    lst.append([d,x,o,y])
lst=sorted(lst,key=lambda x:(x[2],x[3],x[0],x[1]))
# print(lst)  #純粋な日付、時間
tmp=[lst[0][0],lst[0][1],lst[0][2],lst[0][3]]
cnt=0 #部屋の稼働室数

after_hizuke=[]
for i in range(m):#時間加算後リスト(1分後)
    tm1,tm2=hizuke ( lst[i][2] , lst[i][3] )
    after_hizuke.append([lst[i][0],lst[i][1],tm1,tm2])
#print(after_hizuke)


heya=[]
# print(heya)


for i in range(0,m):
    tmp3=[]
    heya_num=len(heya)
    for j in range(4):
        # print(after_hizuke[i][j])
        # print(i,j)
        tmp3.append(after_hizuke[i][j])
    if heya==[]:
        heya.append(tmp3)
        cnt+=1
       # print("A:",heya,cnt)

    elif heya_num>0 and heya_num<=n:
        for k in range(heya_num):
            if heya[k][2]<tmp3[0] or heya[k][2]==tmp3[0] and heya[k][3]<=tmp3[1]:
                heya[k]=tmp3
                cnt+=1
                #print("B:",heya,cnt)
            elif heya_num<n:
                heya.append(tmp3)
                cnt += 1
                heya_num=len(heya)
                #print("C:",heya,cnt)

    else:
        for j in range(n):
            if heya[j][2]<after_hizuke[i][0] or heya[j][2]==after_hizuke[i][0] and heya[j][3]<=after_hizuke[i][1]:
                cnt+=1
                heya[j][0] = after_hizuke[i][0]
                heya[j][1] = after_hizuke[i][1]
                heya[j][2]=after_hizuke[i][2]
                heya[j][3]=after_hizuke[i][3]
                #print("D:",heya,cnt)
                break
    # tmp1=[0,0]
    # tmp1[0]=lst[i][0]
    # tmp1[1]=lst[i][1]
    # if tmp[1]<=tmp1[0]:
    #     cnt+=1
    #     tmp[0]=lst[i][0]
    #     tmp[1]=lst[i][1]
print(cnt)
0