結果
問題 |
No.2879 Range Flip Queries
|
ユーザー |
![]() |
提出日時 | 2024-09-12 14:20:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 2,053 ms |
コンパイル使用メモリ | 194,024 KB |
最終ジャッジ日時 | 2025-02-24 06:44:59 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int N, Q; std::cin >> N >> Q; std::vector<int> A(N); for(int i=0;i<N;i++){ std::cin >> A[i]; } std::vector<int> B(N + 1, 0); for(int _=0;_<Q;_++){ int L, R; std::cin >> L >> R; B[L - 1] ^= 1; B[R] ^= 1; } for(int i=1;i<N;i++){ B[i] ^= B[i - 1]; } for(int i=0;i<N;i++){ std::cout << (A[i] ^ B[i]) << " \n"[i + 1 == N]; } }