結果
問題 |
No.1199 お菓子配り-2
|
ユーザー |
![]() |
提出日時 | 2021-07-30 19:30:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 538 ms / 1,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 1,893 ms |
コンパイル使用メモリ | 195,484 KB |
最終ジャッジ日時 | 2025-01-23 10:20:42 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) #define int long long signed main(){ int n,m; cin>>m>>n; vector<int>s(m,0); rep(i,m){ int sum=0; rep(j,n){ int temp; cin>>temp; sum+=temp; } s[i]=sum; } int odd=0; int even=0; rep(i,m){ int t=odd; odd=max(odd,even+s[i]); even=max(even,t-s[i]); } cout<<max(odd,even)<<endl; }