結果

問題 No.1430 Coup de Coupon
ユーザー NoaSaberNoaSaber
提出日時 2021-04-26 13:39:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,207 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 78,916 KB
最終ジャッジ日時 2023-09-18 06:14:39
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,436 KB
testcase_01 AC 75 ms
71,580 KB
testcase_02 AC 75 ms
71,336 KB
testcase_03 AC 100 ms
76,932 KB
testcase_04 AC 102 ms
76,924 KB
testcase_05 AC 102 ms
76,900 KB
testcase_06 AC 129 ms
78,316 KB
testcase_07 AC 134 ms
78,388 KB
testcase_08 AC 127 ms
78,232 KB
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 AC 134 ms
78,604 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 79 ms
71,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,C=map(int,input().split())
P=[int(input()) for i in range(N)]
disc=[]
disc_per=[]
P.sort(reverse=True)
for i in range(C):
    t,x=map(int,input().split())
    if t==1:
        disc.append(x)
    else:
        disc_per.append(x)
disc_per.sort(reverse=True)
disc.sort(reverse=True)
posi,posi_per=0,0
ans=0
for j,i in enumerate(P):
    if len(disc)<=posi and len(disc_per)<=posi_per:
        ans+=i
        continue
    if len(disc)<=posi:
        pt1=i
    else:
        pt1=max(i-disc[posi],0)
    if len(disc_per)<=posi_per:
        pt2=i
    else:
        pt2=max(i*(100-disc_per[posi_per])//100,0)
    if pt1>pt2:
        posi_per+=1
        ans+=pt2
    elif pt2>pt1:
        posi+=1
        ans+=pt1
    else:
        if j==len(P)-1:
            ans+=pt1
            break
        else:
            ans+=pt1
            next=P[j+1]
            if len(disc)<=posi+1:
                pt1=i
            else:
                pt1=max(next-disc[posi+1],0)
            if len(disc_per)<=posi_per+1:
                pt2=i
            else:
                pt2=max(next*(100-disc_per[posi_per+1])//100,0)
            if pt1<pt2:
                posi_per+=1
            else:
                posi+=1
print(ans)
0