結果

問題 No.2879 Range Flip Queries
ユーザー とんぼとんぼ
提出日時 2024-09-08 13:25:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 447 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 1,740 ms
コンパイル使用メモリ 166,784 KB
実行使用メモリ 11,320 KB
最終ジャッジ日時 2024-09-08 13:26:11
合計ジャッジ時間 13,736 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
10,316 KB
testcase_01 AC 4 ms
9,680 KB
testcase_02 AC 4 ms
9,296 KB
testcase_03 AC 150 ms
9,684 KB
testcase_04 AC 150 ms
9,932 KB
testcase_05 AC 151 ms
10,068 KB
testcase_06 AC 153 ms
9,548 KB
testcase_07 AC 151 ms
9,420 KB
testcase_08 AC 4 ms
9,936 KB
testcase_09 AC 4 ms
10,064 KB
testcase_10 AC 5 ms
10,832 KB
testcase_11 AC 3 ms
9,680 KB
testcase_12 AC 4 ms
10,576 KB
testcase_13 AC 330 ms
10,428 KB
testcase_14 AC 348 ms
11,092 KB
testcase_15 AC 250 ms
11,140 KB
testcase_16 AC 102 ms
11,228 KB
testcase_17 AC 235 ms
11,196 KB
testcase_18 AC 416 ms
11,128 KB
testcase_19 AC 446 ms
11,116 KB
testcase_20 AC 414 ms
11,320 KB
testcase_21 AC 419 ms
11,132 KB
testcase_22 AC 418 ms
11,192 KB
testcase_23 AC 419 ms
11,248 KB
testcase_24 AC 447 ms
11,304 KB
testcase_25 AC 420 ms
11,240 KB
testcase_26 AC 420 ms
11,216 KB
testcase_27 AC 424 ms
11,132 KB
testcase_28 AC 419 ms
11,276 KB
testcase_29 AC 351 ms
11,232 KB
testcase_30 AC 346 ms
11,260 KB
testcase_31 AC 346 ms
11,180 KB
testcase_32 AC 375 ms
11,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(i=0;i<N;i++)
#define ll long long

int main(void){
    int N,Q;
    int A[500009];
    int L[500009];
    int R[500009];

    int i;

    cin>>N>>Q;
    rep(i,N)cin>>A[i+1LL];
    rep(i,Q)cin>>L[i]>>R[i];

    int add[500009]={0};
    rep(i,Q){
        add[L[i]]++;add[R[i]+1LL]--;
    }
    for(i=1;i<=N;i++){
        add[i]+=add[i-1];
        A[i]+=add[i];
        A[i]%=2;
        cout<<A[i]<<' ';
    }
    cout<<endl;

    return 0;
}
0