結果

問題 No.999 てん vs. ほむ
ユーザー otamay6otamay6
提出日時 2020-02-28 21:30:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 164,724 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-21 17:54:15
合計ジャッジ時間 3,540 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 68 ms
6,016 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 16 ms
5,376 KB
testcase_12 AC 33 ms
5,376 KB
testcase_13 AC 76 ms
6,528 KB
testcase_14 AC 78 ms
6,528 KB
testcase_15 AC 79 ms
6,400 KB
testcase_16 AC 78 ms
6,400 KB
testcase_17 AC 51 ms
6,144 KB
testcase_18 AC 51 ms
6,144 KB
testcase_19 AC 54 ms
6,144 KB
testcase_20 AC 51 ms
6,272 KB
testcase_21 AC 75 ms
6,272 KB
testcase_22 AC 74 ms
6,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    vector<ll> A(2*N);
    REP(i,2*N) cin>>A[i];
    int l=0,r=2*N-1;
    ll ans=0;
    vector<ll> ev(N+1),od(N+1);
    REP(i,N){
        ev[i+1]=ev[i]+A[2*i];
        od[i+1]=od[i]+A[2*i+1];
    }
    REP(i,N+1){
        ans=max(ans,2*ev[i]-2*od[i]+od[N]-ev[N]);
    }
    cout<<ans<<endl;
}
0