結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー Today03Today03
提出日時 2024-10-18 22:05:24
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,572 ms / 6,000 ms
コード長 953 bytes
コンパイル時間 2,919 ms
コンパイル使用メモリ 249,092 KB
実行使用メモリ 11,996 KB
最終ジャッジ日時 2024-10-18 22:46:02
合計ジャッジ時間 7,881 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,064 KB
testcase_01 AC 4 ms
7,892 KB
testcase_02 AC 5 ms
7,936 KB
testcase_03 AC 5 ms
7,936 KB
testcase_04 AC 5 ms
8,064 KB
testcase_05 AC 5 ms
8,064 KB
testcase_06 AC 6 ms
8,064 KB
testcase_07 AC 4 ms
8,024 KB
testcase_08 AC 6 ms
7,916 KB
testcase_09 AC 6 ms
8,064 KB
testcase_10 AC 5 ms
7,936 KB
testcase_11 AC 534 ms
10,240 KB
testcase_12 AC 1,301 ms
11,008 KB
testcase_13 AC 1,331 ms
8,960 KB
testcase_14 AC 638 ms
10,956 KB
testcase_15 AC 391 ms
11,404 KB
testcase_16 AC 1,173 ms
8,448 KB
testcase_17 AC 240 ms
9,248 KB
testcase_18 AC 875 ms
9,216 KB
testcase_19 AC 1,572 ms
9,628 KB
testcase_20 AC 333 ms
10,240 KB
testcase_21 AC 954 ms
11,924 KB
testcase_22 AC 904 ms
11,996 KB
testcase_23 AC 559 ms
8,704 KB
testcase_24 AC 5 ms
8,064 KB
testcase_25 AC 4 ms
7,848 KB
testcase_26 AC 1,372 ms
11,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#include <atcoder/fenwicktree>

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

    const int mx = 3e5;

    atcoder::fenwick_tree<ll> fen1(mx), fen2(mx);
    for (int i = 0; i < N; i++) {
        fen1.add(A[i], 1);
        fen2.add(A[i], A[i]);
    }

    bool ok = false;

    while (Q--) {
        int t;
        cin >> t;

        if (t == 1) {
            int l;
            cin >> l;
            fen1.add(l, 1);
            fen2.add(l, l);
        }

        else if (t == 2) {
            int l, r;
            cin >> l >> r;
            ok = true;

            cout << fen1.sum(l, r + 1) << ' ' << fen2.sum(l, r + 1) << '\n';
        }

        else {
            int m;
            cin >> m;
        }
    }

    if (!ok) cout << "Not Found!" << endl;
}
0