結果

問題 No.973 余興
ユーザー tekihei2317tekihei2317
提出日時 2020-01-17 22:55:15
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
OLE  
実行時間 -
コード長 859 bytes
コンパイル時間 1,588 ms
コンパイル使用メモリ 172,044 KB
実行使用メモリ 8,908 KB
最終ジャッジ日時 2023-09-08 06:17:40
合計ジャッジ時間 22,495 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 OLE -
testcase_01 OLE -
testcase_02 OLE -
testcase_03 OLE -
testcase_04 OLE -
testcase_05 OLE -
testcase_06 OLE -
testcase_07 OLE -
testcase_08 OLE -
testcase_09 OLE -
testcase_10 OLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

using Lint=long long;

int main()
{
   int N,X; cin>>N>>X;
   vector<int> a(N);
   for(int i=0;i<N;i++) cin>>a[i];

   vector<vector<bool>> dp(N+1,vector<bool>(N+1));
   for(int i=0;i<=N;i++) dp[i][i]=true;

   for(int len=1;len<=N;len++){
      for(int l=0;l+len<=N;l++){
         int r=l+len;
         Lint sum=0;
         for(int i=l;i<r;i++){
            sum+=a[i]; if(sum>X) break;
            // dp[l][r]|=!dp[i+1][r];
            if(!dp[i+1][r]) dp[l][r]=true;
         }
         sum=0;
         for(int i=r-1;i>=l;i--){
            sum+=a[i]; if(sum>X) break;
            // dp[l][r]|=!dp[l][i];
            if(!dp[l][i]) dp[l][r]=true;
         }
      }
   }
   for(int i=0;i<=N;i++){
      for(int j=i;j<=N;j++) cout<<dp[i][j]<<' '; cout<<endl;
   }
   cout<<(dp[0][N]? 'A':'B')<<endl;
   return 0;
}
0