結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー cled0328
提出日時 2024-10-18 22:07:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,738 ms / 6,000 ms
コード長 728 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 195,660 KB
最終ジャッジ日時 2025-02-24 20:48:30
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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