結果

問題 No.230 Splarraay スプラレェーイ
ユーザー maine_honzukimaine_honzuki
提出日時 2021-03-03 22:50:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 852 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 198,272 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 14:43:31
合計ジャッジ時間 13,536 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 9 ms
6,944 KB
testcase_06 AC 73 ms
6,940 KB
testcase_07 AC 8 ms
6,944 KB
testcase_08 AC 32 ms
6,944 KB
testcase_09 AC 648 ms
6,940 KB
testcase_10 AC 1,138 ms
6,944 KB
testcase_11 AC 294 ms
6,940 KB
testcase_12 AC 663 ms
6,944 KB
testcase_13 AC 98 ms
6,944 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1,264 ms
6,944 KB
testcase_17 AC 1,254 ms
6,944 KB
testcase_18 AC 1,191 ms
6,944 KB
testcase_19 AC 521 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, Q;
    cin >> N >> Q;
    const int LEN = 100010;
    bitset<LEN> B[2], mask;
    int ans[2] = {};
    while (Q--) {
        int x, l, r;
        cin >> x >> l >> r;
        r++;
        mask.reset();
        mask.flip();
        mask >>= LEN - (r - l);
        mask <<= l;
        if (x == 0) {
            int cnt[2];
            cnt[0] = (mask & B[0]).count();
            cnt[1] = (mask & B[1]).count();
            if (cnt[0] > cnt[1])
                ans[0] += cnt[0];
            else if (cnt[1] > cnt[0])
                ans[1] += cnt[1];
        } else {
            x--;
            B[x] |= mask;
            mask.flip();
            B[1 - x] &= mask;
        }
    }
    ans[0] += B[0].count();
    ans[1] += B[1].count();
    cout << ans[0] << " " << ans[1] << endl;
}
0