結果

問題 No.2879 Range Flip Queries
ユーザー Today03Today03
提出日時 2024-09-10 01:08:30
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 451 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 3,003 ms
コンパイル使用メモリ 246,452 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-09-10 01:08:46
合計ジャッジ時間 14,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 142 ms
6,944 KB
testcase_04 AC 142 ms
6,944 KB
testcase_05 AC 148 ms
6,944 KB
testcase_06 AC 142 ms
6,944 KB
testcase_07 AC 144 ms
6,944 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 338 ms
6,944 KB
testcase_14 AC 342 ms
6,944 KB
testcase_15 AC 234 ms
6,940 KB
testcase_16 AC 96 ms
6,940 KB
testcase_17 AC 235 ms
6,940 KB
testcase_18 AC 424 ms
7,168 KB
testcase_19 AC 433 ms
7,040 KB
testcase_20 AC 417 ms
7,168 KB
testcase_21 AC 451 ms
7,168 KB
testcase_22 AC 414 ms
7,040 KB
testcase_23 AC 419 ms
7,168 KB
testcase_24 AC 443 ms
7,168 KB
testcase_25 AC 414 ms
7,168 KB
testcase_26 AC 438 ms
7,168 KB
testcase_27 AC 414 ms
7,168 KB
testcase_28 AC 418 ms
7,296 KB
testcase_29 AC 346 ms
7,296 KB
testcase_30 AC 331 ms
7,040 KB
testcase_31 AC 329 ms
7,168 KB
testcase_32 AC 361 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    vector<int> I(N + 1);
    while (Q--) {
        int l, r;
        cin >> l >> r;
        l--;
        I[l] ^= 1;
        I[r] ^= 1;
    }

    for (int i = 0; i < N; i++) I[i + 1] ^= I[i];

    for (int i = 0; i < N; i++) cout << (A[i] ^ I[i]) << ' ';
    cout << endl;
}
0