結果
問題 |
No.1199 お菓子配り-2
|
ユーザー |
|
提出日時 | 2020-09-06 21:45:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 125 ms / 1,000 ms |
コード長 | 697 bytes |
コンパイル時間 | 1,129 ms |
コンパイル使用メモリ | 105,592 KB |
最終ジャッジ日時 | 2025-01-14 08:04:10 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
#include <cmath> #include <vector> #include <iostream> #include <algorithm> #include <set> #include <iomanip> #include <numeric> #include <queue> #include <string> #include <map> #include <fstream> #include <cassert> #include <stack> #include <climits> int main() { std::cin.tie(nullptr); std::cin.sync_with_stdio(false); int n, m; std::cin >> n >> m; long long int odd{ 0 }, even{ LLONG_MIN >> 1}; for (auto i = 0; i < n; ++i) { long long int h{ 0 }; for (auto i = 0; i < m; ++i) { long long int a; std::cin >> a; h += a; } const auto o = std::max(odd, even - h); const auto e = std::max(even, odd + h); odd = o; even = e; } std::cout << std::max(odd, even) << '\n'; }