結果
| 問題 |
No.2879 Range Flip Queries
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2024-12-25 00:42:30 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,358 ms / 2,000 ms |
| コード長 | 876 bytes |
| コンパイル時間 | 3,650 ms |
| コンパイル使用メモリ | 252,792 KB |
| 実行使用メモリ | 5,504 KB |
| 最終ジャッジ日時 | 2024-12-25 00:43:10 |
| 合計ジャッジ時間 | 35,821 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
#include <atcoder/lazysegtree>
bool op(bool a, bool b) { return a || b; } // なんでも
bool e() { return false; } // なんでも
bool mapping(bool f, bool x) { return f ^ x; }
bool composition(bool f, bool g) { return f ^ g; }
bool id() { return false; }
int main() {
int n, q;
cin >> n >> q;
vector<int> a(n);
rep(i, n) cin >> a[i];
atcoder::lazy_segtree<bool, op, e, bool, mapping, composition, id> seg(n);
rep(i, n) seg.set(i, a[i] == 1);
while (q--) {
int l, r;
cin >> l >> r;
seg.apply(l - 1, r, true);
}
rep(i, n) cout << (seg.get(i) ? 1 : 0) << ' ';
cout << endl;
return 0;
}
a01sa01to