結果

問題 No.2693 Sword
ユーザー nikoro256nikoro256
提出日時 2024-03-22 21:52:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 68,152 KB
最終ジャッジ日時 2024-03-22 21:52:59
合計ジャッジ時間 2,717 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 WA -
testcase_05 AC 37 ms
53,460 KB
testcase_06 WA -
testcase_07 AC 37 ms
53,460 KB
testcase_08 WA -
testcase_09 AC 48 ms
55,584 KB
testcase_10 AC 40 ms
53,460 KB
testcase_11 AC 44 ms
55,584 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 42 ms
53,460 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 53 ms
61,628 KB
testcase_16 AC 57 ms
63,872 KB
testcase_17 AC 55 ms
63,704 KB
testcase_18 AC 50 ms
61,628 KB
testcase_19 AC 50 ms
61,756 KB
testcase_20 AC 58 ms
64,004 KB
testcase_21 AC 62 ms
68,152 KB
testcase_22 AC 56 ms
64,168 KB
testcase_23 AC 51 ms
63,884 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 39 ms
53,460 KB
testcase_30 AC 37 ms
53,460 KB
testcase_31 AC 38 ms
53,460 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P,K=map(int,input().split())
counttwo=0
ones=[]
dat=[]
for _ in range(N):
    t,b=map(int,input().split())
    if t==2:
        counttwo+=1
    else:
        ones.append(b)
    dat.append([t,b])
ones.sort(reverse=True)
ans=0
for i in range(min(counttwo+1,K)):
    use=K-i
    if len(ones)>=use:
        lis=[]
        mul=1
        twocount=0
        count=0
        for j in range(N-1,-1,-1):
            if dat[j][0]==2:
                if twocount<i:
                    mul*=2
                    twocount+=1
            else:
                lis.append(mul*dat[j][1])
        lis.sort(reverse=True)
        tmp=P*mul+sum(lis[:use])
        if tmp>=10**18:
            print(-1)
            exit(0)
        ans=max(ans,tmp)
print(ans)
0