結果

問題 No.2879 Range Flip Queries
ユーザー nonon
提出日時 2024-09-08 12:32:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 198,720 KB
最終ジャッジ日時 2025-02-24 05:20:04
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/lazysegtree>
using namespace std;
int op(int a, int b){return a^b;}
int e(){return 0;}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,Q;
    cin>>N>>Q;
    vector<int>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    atcoder::lazy_segtree<int,op,e,int,op,op,e>seg(A);
    while(Q--)
    {
        int L,R;
        cin>>L>>R;
        L--;
        seg.apply(L,R,1);
    }
    for(int i=0;i<N;i++)cout<<seg.get(i)<<" \n"[i+1==N];
}
0