結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー hitonanodehitonanode
提出日時 2024-10-18 21:44:09
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 388 ms / 6,000 ms
コード長 984 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 91,740 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-18 22:35:24
合計ジャッジ時間 8,135 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 3 ms
6,824 KB
testcase_02 AC 3 ms
6,816 KB
testcase_03 AC 4 ms
6,820 KB
testcase_04 AC 3 ms
6,820 KB
testcase_05 AC 4 ms
6,820 KB
testcase_06 AC 3 ms
6,820 KB
testcase_07 AC 4 ms
6,820 KB
testcase_08 AC 4 ms
6,816 KB
testcase_09 AC 4 ms
6,820 KB
testcase_10 AC 4 ms
6,816 KB
testcase_11 AC 158 ms
6,824 KB
testcase_12 AC 344 ms
6,820 KB
testcase_13 AC 323 ms
6,816 KB
testcase_14 AC 184 ms
6,820 KB
testcase_15 AC 137 ms
6,816 KB
testcase_16 AC 290 ms
6,820 KB
testcase_17 AC 76 ms
6,816 KB
testcase_18 AC 218 ms
6,816 KB
testcase_19 AC 388 ms
6,824 KB
testcase_20 AC 119 ms
6,820 KB
testcase_21 AC 340 ms
6,820 KB
testcase_22 AC 339 ms
6,816 KB
testcase_23 AC 126 ms
6,820 KB
testcase_24 AC 4 ms
6,820 KB
testcase_25 AC 4 ms
6,816 KB
testcase_26 AC 366 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

#include <atcoder/fenwicktree>
using namespace std;

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);

    int N, Q, L0;
    cin >> N >> Q >> L0;
    
    // vector<int> L(Q + 1);
    // L[0] = L0;

    auto Li = L0;

    constexpr int K = 201010;

    atcoder::fenwick_tree<int> fw0(K);
    atcoder::fenwick_tree<long long> fw1(K);

    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        fw0.add(a, 1);
        fw1.add(a, a);
    }

    bool has2 = false;

    for (int i = 1; i <= Q; ++i) {
        int tp;
        cin >> tp;
        if (tp == 1) {
            int l;
            cin >> l;
            fw0.add(l, 1);
            fw1.add(l, l);
        } else if (tp == 2) {
            int l, r;
            cin >> l >> r;
            ++r;
            cout << fw0.sum(l, r) << ' ' << fw1.sum(l, r) << '\n';
            has2 = true;
        } else {
            cin >> Li;
        }
    }

    if (!has2) puts("Not Found!");
}
0