結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2020-03-01 06:42:36 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 549 bytes |
| コンパイル時間 | 735 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 20:30:08 |
| 合計ジャッジ時間 | 1,796 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
// yuki 999 てん vs. ほむ
// 2020.2.28 bal4u
#include <stdio.h>
typedef long long ll;
int getchar_unlocked(void);
#define gc() getchar_unlocked()
int in() { // 整数の入力
int n = 0; int c = gc();
do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
return n;
}
ll s[100005];
int main()
{
int i, N;
ll ans, t;
N = in();
for (i = 1; i <= N; ++i) {
s[i] = s[i-1] + (in() - in());
}
ans = -0xfffffffffffffffLL;
for (i = 0; i <= N; ++i) {
t = (s[i] << 1);
if (t > ans) ans = t;
}
printf("%lld\n", ans-s[N]);
return 0;
}
bal4u