結果

問題 No.2879 Range Flip Queries
ユーザー Iroha_3856Iroha_3856
提出日時 2024-06-06 20:33:32
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 463 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 87,976 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-09-08 12:00:49
合計ジャッジ時間 12,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 148 ms
6,944 KB
testcase_04 AC 148 ms
6,944 KB
testcase_05 AC 147 ms
6,944 KB
testcase_06 AC 147 ms
6,940 KB
testcase_07 AC 147 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 340 ms
6,944 KB
testcase_14 AC 369 ms
6,940 KB
testcase_15 AC 255 ms
6,944 KB
testcase_16 AC 105 ms
6,940 KB
testcase_17 AC 260 ms
6,940 KB
testcase_18 AC 453 ms
7,040 KB
testcase_19 AC 453 ms
7,040 KB
testcase_20 AC 452 ms
7,040 KB
testcase_21 AC 463 ms
7,168 KB
testcase_22 AC 452 ms
7,168 KB
testcase_23 AC 448 ms
6,944 KB
testcase_24 AC 451 ms
7,168 KB
testcase_25 AC 449 ms
7,168 KB
testcase_26 AC 456 ms
7,168 KB
testcase_27 AC 456 ms
7,168 KB
testcase_28 AC 456 ms
7,168 KB
testcase_29 AC 356 ms
7,168 KB
testcase_30 AC 359 ms
7,296 KB
testcase_31 AC 358 ms
7,296 KB
testcase_32 AC 358 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
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> Flip(N+1, 0);
    for (int i = 0; i < Q; i++) {
        int L, R; cin >> L >> R;
        L--;
        Flip[L] ^= 1;
        Flip[R] ^= 1;
    }
    for (int i = 1; i <= N; i++) {
        Flip[i] ^= Flip[i-1];
    }
    for (int i = 0; i < N; i++) {
        int s = A[i] ^ Flip[i];
        cout << s;
        if (i != N-1) cout << " ";
    }
    cout << endl;
}
0