結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2020-02-28 21:28:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 549 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 75,332 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 16:47:12 |
| 合計ジャッジ時間 | 1,951 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
ll s = 0;
vector<int> a(n);
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
s += a[i] = y - x;
}
ll r = s;
for (int i = 0; i < n; i++) {
s -= a[i] * 2;
r = max(r, s);
}
cout << r << endl;
return 0;
}
merom686