結果

問題 No.999 てん vs. ほむ
ユーザー totori_nyaatotori_nyaa
提出日時 2020-02-28 21:27:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 163,320 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 17:49:19
合計ジャッジ時間 3,284 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 26 ms
6,940 KB
testcase_10 AC 9 ms
6,944 KB
testcase_11 AC 7 ms
6,944 KB
testcase_12 AC 12 ms
6,940 KB
testcase_13 AC 27 ms
6,944 KB
testcase_14 AC 27 ms
6,940 KB
testcase_15 AC 28 ms
6,944 KB
testcase_16 AC 27 ms
6,944 KB
testcase_17 AC 19 ms
6,944 KB
testcase_18 WA -
testcase_19 AC 19 ms
6,944 KB
testcase_20 WA -
testcase_21 AC 26 ms
6,940 KB
testcase_22 AC 25 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    ll a[2*n];
    for(int i=0;i<2*n;i++){
        cin>>a[i];
    }
    ll l[n+1]={},r[n+1]={};
    for(int i=0;i<n;i++){
        l[i+1] = l[i] + a[2*i] - a[2*i+1];
        r[n-i-1] = r[n-i] + a[2*n-1-2*i] - a[2*n-2-2*i];
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans = max(ans,l[i]+r[i]);
    }
    cout << ans << endl;
}
0