結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー kazuppakazuppa
提出日時 2024-10-17 23:14:32
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,369 ms / 6,000 ms
コード長 869 bytes
コンパイル時間 5,532 ms
コンパイル使用メモリ 336,904 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-17 23:14:55
合計ジャッジ時間 20,013 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 3 ms
6,816 KB
testcase_02 AC 4 ms
6,816 KB
testcase_03 AC 3 ms
6,816 KB
testcase_04 AC 3 ms
6,820 KB
testcase_05 AC 3 ms
6,816 KB
testcase_06 AC 4 ms
6,816 KB
testcase_07 AC 3 ms
6,816 KB
testcase_08 AC 4 ms
6,820 KB
testcase_09 AC 4 ms
6,820 KB
testcase_10 AC 3 ms
6,816 KB
testcase_11 AC 457 ms
6,820 KB
testcase_12 AC 1,149 ms
6,816 KB
testcase_13 AC 1,157 ms
6,816 KB
testcase_14 AC 530 ms
6,820 KB
testcase_15 AC 341 ms
6,816 KB
testcase_16 AC 1,065 ms
6,816 KB
testcase_17 AC 229 ms
6,816 KB
testcase_18 AC 760 ms
6,816 KB
testcase_19 AC 1,369 ms
6,820 KB
testcase_20 AC 315 ms
6,816 KB
testcase_21 AC 769 ms
6,816 KB
testcase_22 AC 795 ms
6,816 KB
testcase_23 AC 471 ms
6,816 KB
testcase_24 AC 4 ms
6,820 KB
testcase_25 AC 4 ms
6,816 KB
testcase_26 AC 1,169 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#include <atcoder/all>
using namespace atcoder;

int main(){
    int n, q, l;
    cin >> n >> q >> l;
    fenwick_tree<int> sum(200001);
    fenwick_tree<ll> level(200001);
    bool query2 = false;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        sum.add(a, 1);
        level.add(a, a);
    }
    for(int i = 0; i < q; i++) {
        int t;cin>>t;
        if(t==1){
            int l;
            cin >> l;
            sum.add(l, 1);
            level.add(l, l);
        }
        if(t==2){
            query2 = true;
            int l, r;
            cin >> l >> r;
            cout << sum.sum(l, r + 1) << ' ' << level.sum(l, r+1) << endl;
        }
        if(t == 3){
            int l;
            cin >> l;
        }
    }
    if(!query2)
        cout << "Not Found!\n";
}
0