結果
| 問題 |
No.2879 Range Flip Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-09 00:35:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 864 ms / 2,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 5,699 ms |
| コンパイル使用メモリ | 311,832 KB |
| 実行使用メモリ | 19,608 KB |
| 最終ジャッジ日時 | 2024-09-09 00:36:21 |
| 合計ジャッジ時間 | 23,684 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using S = long long;
using F = long long;
const S INF = 8e18;
S op(S a, S b){ return std::min(a, b); }
S e(){ return INF; }
S mapping(F f, S x){ return (f+x)%2; }
F composition(F f, F g){ return (f+g)%2; }
F id(){ return 0; }
int main(){
ll n,q;
cin>>n>>q;
vector<ll> a(n);
for(ll i=0;i<n;i++){
cin>>a[i];
}
lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
while(q--){
ll l,r;
cin>>l>>r;
l--;
seg.apply(l,r,1);
}
for(ll i=0;i<n;i++){
cout<<seg.get(i)<<" ";
}
cout<<endl;
}