結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー cled0328cled0328
提出日時 2024-10-18 22:07:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,593 ms / 6,000 ms
コード長 728 bytes
コンパイル時間 2,294 ms
コンパイル使用メモリ 203,424 KB
実行使用メモリ 23,784 KB
最終ジャッジ日時 2024-10-18 22:46:22
合計ジャッジ時間 18,730 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
18,788 KB
testcase_01 AC 7 ms
18,848 KB
testcase_02 AC 8 ms
18,960 KB
testcase_03 AC 8 ms
18,936 KB
testcase_04 AC 9 ms
18,892 KB
testcase_05 AC 7 ms
18,904 KB
testcase_06 AC 7 ms
18,900 KB
testcase_07 AC 8 ms
18,996 KB
testcase_08 AC 8 ms
18,792 KB
testcase_09 AC 9 ms
18,840 KB
testcase_10 AC 8 ms
18,784 KB
testcase_11 AC 539 ms
22,384 KB
testcase_12 AC 1,348 ms
22,536 KB
testcase_13 AC 1,346 ms
19,816 KB
testcase_14 AC 677 ms
22,436 KB
testcase_15 AC 418 ms
23,784 KB
testcase_16 AC 1,264 ms
19,424 KB
testcase_17 AC 256 ms
20,196 KB
testcase_18 AC 880 ms
21,308 KB
testcase_19 AC 1,593 ms
20,980 KB
testcase_20 AC 350 ms
21,372 KB
testcase_21 AC 955 ms
22,840 KB
testcase_22 AC 1,021 ms
22,716 KB
testcase_23 AC 571 ms
19,652 KB
testcase_24 AC 7 ms
18,936 KB
testcase_25 AC 7 ms
18,796 KB
testcase_26 AC 1,418 ms
23,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/fenwicktree>
using namespace std;
using namespace atcoder;
int q,l0;
int a[10<<17];
int main(){
    int n;
    cin>>n>>q>>l0;
    bool nf=true;
    fenwick_tree<long long> BIT1(1000001),BIT2(1000001);
    for(int i=0;i<n;i++){
        cin>>a[i];
        BIT1.add(a[i],1);
        BIT2.add(a[i],a[i]);
    }
    while(q--){
        int op;cin>>op;
        if(op==1){
            int l;cin>>l;
            BIT1.add(l,1);
            BIT2.add(l,l);
        }else if(op==2){
            int l,r;cin>>l>>r;
            r++;
            cout<<BIT1.sum(l,r)<<" "<<BIT2.sum(l,r)<<"\n";
            nf=false;
        }else{
            cin>>l0;
        }
    }
    if(nf)cout<<"Not Found!\n";
}
0