結果

問題 No.1199 お菓子配り-2
ユーザー chocono2230chocono2230
提出日時 2020-08-28 21:50:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,064 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 166,276 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 14:44:32
合計ジャッジ時間 16,949 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 102 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 77 ms
5,376 KB
testcase_13 AC 28 ms
5,376 KB
testcase_14 AC 22 ms
5,376 KB
testcase_15 AC 20 ms
5,376 KB
testcase_16 AC 168 ms
5,376 KB
testcase_17 AC 80 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 323 ms
5,376 KB
testcase_21 AC 203 ms
5,376 KB
testcase_22 AC 109 ms
5,376 KB
testcase_23 AC 150 ms
5,376 KB
testcase_24 AC 201 ms
5,376 KB
testcase_25 AC 31 ms
5,376 KB
testcase_26 AC 217 ms
5,376 KB
testcase_27 AC 186 ms
5,376 KB
testcase_28 AC 434 ms
5,376 KB
testcase_29 AC 434 ms
5,376 KB
testcase_30 WA -
testcase_31 AC 407 ms
5,376 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 416 ms
5,376 KB
testcase_36 AC 416 ms
5,376 KB
testcase_37 WA -
testcase_38 AC 408 ms
5,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 432 ms
5,376 KB
testcase_47 AC 431 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<ll> a(n, 0);
  rep(i, n)rep(j, m){
    ll in;
    cin >> in;
    a.at(i) += in;
  }
  a.push_back(LLONG_MAX);
  ll ans = 0;
  rep(i, n){
    ll add = a.at(i);
    bool mode = false;
    ll bf = -1;
    rep2(j, i+1, n){
      if(mode == false){
        if(a.at(j) < a.at(j+1)){
          bf = a.at(j);
          mode = true;
        }
      }else{
        if(a.at(j) > a.at(j+1)){
          add += a.at(j) - bf;
          mode = false;
        }
      }
    }
    ans = max(ans, add);
  }
  cout << ans << endl;
  return 0;
}
0