結果
| 問題 |
No.2879 Range Flip Queries
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-03 16:11:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 519 ms / 2,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 3,211 ms |
| コンパイル使用メモリ | 278,620 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-03 16:12:04 |
| 合計ジャッジ時間 | 21,079 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, q;
cin >> n >> q;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
vector<int> t(n + 1);
while (q--) {
int l, r;
cin >> l >> r;
t[--l]++, t[r]--;
}
for (int i = 1; i <= n; i++) t[i] += t[i - 1];
for (int i = 0; i < n; i++) cout << (t[i] & 1 ? a[i] ^ 1 : a[i]) << " \n"[i == n - 1];
}