結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2020-02-18 01:46:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 419 bytes |
| コンパイル時間 | 730 ms |
| コンパイル使用メモリ | 69,620 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 15:21:41 |
| 合計ジャッジ時間 | 3,266 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<iostream>
#include <vector>
using namespace std;
using ll = long long ;
const ll longinf = 1LL << 60;
int main() {
int n;
cin>>n;
vector<ll> a(n+1);
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
a[i+1]=x-y;
}
for(int i=0;i<n;i++)a[i+1]+=a[i];
ll ans = 0;
for(int i=0;i<=n;i++){
ans = max(ans,2*a[i]-a[n]);
}
cout<<ans<<endl;
return 0;
}
tempura_pp