結果

問題 No.2693 Sword
ユーザー takoootakooo
提出日時 2024-03-22 23:10:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 2,912 ms
コンパイル使用メモリ 250,324 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-03-22 23:10:07
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 3 ms
6,548 KB
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 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
6,548 KB
testcase_25 AC 2 ms
6,548 KB
testcase_26 AC 2 ms
6,548 KB
testcase_27 AC 2 ms
6,548 KB
testcase_28 AC 2 ms
6,548 KB
testcase_29 AC 2 ms
6,548 KB
testcase_30 AC 2 ms
6,548 KB
testcase_31 AC 2 ms
6,548 KB
testcase_32 AC 9 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll INF=1000000000000000000;
int main(){
  ll n,p,k,t,b,x;cin>>n>>p>>k;vector A(n+1,vector<ll>(k+1,-1));A[0][0]=p;
  for(int i=1;i<=n;i++){
    cin>>t>>b;
    for(int j=k-1;j>=0;j--){
      if(A[i-1][j]>=0){
        A[i][j]=max(A[i][j],A[i-1][j]);
        x=A[i-1][j];
        if(t==1){
          if(INF-x>=b)A[i][j+1]=max(x+b,A[i][j+1]);
        }else if(t==2){
          if(INF/2>=x)A[i][j+1]=max(x*2,A[i][j+1]);
        }
      }
    }
  }
  cout<<A[n][k];
}
0