結果

問題 No.2693 Sword
ユーザー ゼットゼット
提出日時 2024-03-22 21:33:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 63,192 KB
最終ジャッジ日時 2024-03-22 21:33:19
合計ジャッジ時間 2,825 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 WA -
testcase_06 AC 39 ms
53,460 KB
testcase_07 WA -
testcase_08 AC 37 ms
53,460 KB
testcase_09 AC 47 ms
55,584 KB
testcase_10 AC 40 ms
53,460 KB
testcase_11 AC 43 ms
55,584 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 41 ms
53,460 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 45 ms
55,584 KB
testcase_16 AC 51 ms
61,108 KB
testcase_17 AC 52 ms
61,100 KB
testcase_18 AC 44 ms
55,584 KB
testcase_19 WA -
testcase_20 AC 48 ms
55,584 KB
testcase_21 AC 52 ms
61,108 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 54 ms
63,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P,K=map(int,input().split())
L1=[]
L2=[]
for i in range(N):
  t,b=map(int,input().split())
  if t==1:
    L1.append(b)
  else:
    L2.append(2)
L1.sort(reverse=True)
L2.sort(reverse=True)
u=[1]
for i in range(len(L2)):
  u.append(L2[i])
result=0
for j in range(1,K+1):
  if j>=len(u):
    break
  u[j]=u[j-1]*u[j]
  if u[j]>10**18:
    print(-1)
    exit()
result=0
for i in range(len(L1)):
  if i>0:
    P+=L1[i-1]
  rest=K-i
  if rest<0:
    break
  if rest<len(u):
    score=P*u[rest]
  else:
    score=P*u[-1]
  result=max(result,score)
if result<=10**18:
  print(result)
else:
  print(-1)
0