結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-29 13:53:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 439 bytes |
| コンパイル時間 | 1,420 ms |
| コンパイル使用メモリ | 170,480 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-10-13 19:58:31 |
| 合計ジャッジ時間 | 3,196 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n;cin >> n;
vector<ll> a(2*n),so(n+1),se(n+1);
for(int i=0;i<2*n;i++){
cin >> a[i];
if(i%2==0){
so[i/2+1]=so[i/2]+a[i];
}
else{
se[i/2+1]=se[i/2]+a[i];
}
}
ll ans=-1e15;
for(int i=0;i<=n;i++){
ans=max(ans,so[i]+se[n]-se[i]-(se[i]+so[n]-so[i]));
}
cout << ans << endl;
}