結果

問題 No.2879 Range Flip Queries
ユーザー kaede2020kaede2020
提出日時 2024-09-08 14:24:46
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 6,095 ms
コンパイル使用メモリ 336,228 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-09-08 14:25:06
合計ジャッジ時間 18,842 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using mint = modint998244353;
#define ull unsigned long long
random_device rnd;
mt19937 mt(rnd());
int RandInt(int a, int b) {
    return a + mt() % (b - a + 1);
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int n,q;
int main(){
    cin>>n>>q;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    vector<int>rui(n+1);
    rep(i,q){
        int l,r;
        cin>>l>>r;
        l--;
        rui[l]++;
        rui[r]--;
    }
    rep(i,n-1)rui[i+1]+=rui[i];
    rep(i,n)if(rui[i]%2==1)cout<<(a[i]^1)<<" ";
    else cout<<a[i]<<" ";
    cout<<endl;
    return 0;
}
0