結果

問題 No.1199 お菓子配り-2
ユーザー PCTprobabilityPCTprobability
提出日時 2020-08-22 15:15:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 448 ms / 1,000 ms
コード長 621 bytes
コンパイル時間 2,352 ms
コンパイル使用メモリ 198,228 KB
実行使用メモリ 11,576 KB
最終ジャッジ日時 2024-04-26 14:08:24
合計ジャッジ時間 18,211 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 116 ms
6,940 KB
testcase_04 AC 281 ms
8,500 KB
testcase_05 AC 10 ms
6,940 KB
testcase_06 AC 16 ms
6,940 KB
testcase_07 AC 138 ms
6,940 KB
testcase_08 AC 189 ms
6,940 KB
testcase_09 AC 113 ms
6,944 KB
testcase_10 AC 29 ms
6,944 KB
testcase_11 AC 87 ms
6,940 KB
testcase_12 AC 102 ms
6,940 KB
testcase_13 AC 32 ms
6,940 KB
testcase_14 AC 26 ms
6,940 KB
testcase_15 AC 22 ms
6,944 KB
testcase_16 AC 181 ms
6,940 KB
testcase_17 AC 87 ms
6,940 KB
testcase_18 AC 190 ms
6,940 KB
testcase_19 AC 50 ms
6,940 KB
testcase_20 AC 337 ms
9,472 KB
testcase_21 AC 208 ms
7,152 KB
testcase_22 AC 111 ms
6,940 KB
testcase_23 AC 152 ms
6,940 KB
testcase_24 AC 208 ms
7,168 KB
testcase_25 AC 32 ms
6,940 KB
testcase_26 AC 233 ms
7,812 KB
testcase_27 AC 188 ms
6,944 KB
testcase_28 AC 441 ms
11,460 KB
testcase_29 AC 439 ms
11,396 KB
testcase_30 AC 442 ms
11,408 KB
testcase_31 AC 444 ms
11,376 KB
testcase_32 AC 440 ms
11,576 KB
testcase_33 AC 439 ms
11,384 KB
testcase_34 AC 444 ms
11,284 KB
testcase_35 AC 444 ms
11,396 KB
testcase_36 AC 442 ms
11,368 KB
testcase_37 AC 442 ms
11,256 KB
testcase_38 AC 443 ms
11,384 KB
testcase_39 AC 442 ms
11,480 KB
testcase_40 AC 444 ms
11,488 KB
testcase_41 AC 446 ms
11,432 KB
testcase_42 AC 442 ms
11,540 KB
testcase_43 AC 443 ms
11,264 KB
testcase_44 AC 448 ms
11,348 KB
testcase_45 AC 444 ms
11,348 KB
testcase_46 AC 438 ms
11,280 KB
testcase_47 AC 443 ms
11,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll= long long;
int main() {
  ll a,b;
  cin>>a>>b;
  assert(a<=1000&&a>=1&&b>=1&&b<=1000);
  ll kouhuku[a][b];
for(ll i=0;i<a;i++){
  for(ll j=0;j<b;j++){
    cin>>kouhuku[i][j];
    assert(kouhuku[i][j]<=10000000000&&kouhuku[i][j]>=1);
  }
}
 vector<ll> n(a);
  for(ll i=0;i<a;i++){
  for(ll j=0;j<b;j++){
    n.at(i)=n.at(i)+kouhuku[i][j];
  }
  }
  
  ll dp[a+1][2];
  dp[0][0]=0;
  dp[0][1]=0;
  for(ll i=1;i<=a;i++){
    dp[i][0]=max(dp[i-1][0],dp[i-1][1]-n.at(i-1));
      dp[i][1]=max(dp[i-1][1],dp[i-1][0]+n.at(i-1));
  }
  cout<<max(dp[a][0],dp[a][1])<<endl;
}
0