結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー otoshigootoshigo
提出日時 2024-10-18 22:10:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 458 ms / 6,000 ms
コード長 1,213 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 205,756 KB
実行使用メモリ 14,272 KB
最終ジャッジ日時 2024-10-18 22:47:15
合計ジャッジ時間 9,903 ms
ジャッジサーバーID
(参考情報)
judge8 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,812 KB
testcase_01 AC 5 ms
6,816 KB
testcase_02 AC 5 ms
6,820 KB
testcase_03 AC 4 ms
6,816 KB
testcase_04 AC 4 ms
6,816 KB
testcase_05 AC 4 ms
6,820 KB
testcase_06 AC 4 ms
6,824 KB
testcase_07 AC 5 ms
6,820 KB
testcase_08 AC 5 ms
6,820 KB
testcase_09 AC 5 ms
6,816 KB
testcase_10 AC 5 ms
6,824 KB
testcase_11 AC 211 ms
9,600 KB
testcase_12 AC 458 ms
12,160 KB
testcase_13 AC 349 ms
10,560 KB
testcase_14 AC 228 ms
10,368 KB
testcase_15 AC 162 ms
9,984 KB
testcase_16 AC 312 ms
10,020 KB
testcase_17 AC 87 ms
7,808 KB
testcase_18 AC 243 ms
9,728 KB
testcase_19 AC 441 ms
11,628 KB
testcase_20 AC 128 ms
8,960 KB
testcase_21 AC 377 ms
14,272 KB
testcase_22 AC 371 ms
14,004 KB
testcase_23 AC 135 ms
7,936 KB
testcase_24 AC 4 ms
6,824 KB
testcase_25 AC 4 ms
6,820 KB
testcase_26 AC 418 ms
14,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/fenwicktree>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

const int MAX=200'000;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,Q;
    cin>>N>>Q;
    vector<int>L(Q+1);
    cin>>L[0];
    vector<int>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    atcoder::fenwick_tree<ll>fw1(MAX+1),fw2(MAX+1);
    for(int i=0;i<N;i++){
        fw1.add(A[i],1);
        fw2.add(A[i],A[i]);
    }
    bool flag=false;
    for(int q=1;q<=Q;q++){
        int t;
        cin>>t;
        if(t==1){
            int l;
            cin>>l;
            fw1.add(l,1);
            fw2.add(l,l);
            L[q]=L[q-1];
        }else if(t==2){
            flag=true;
            int l,r;
            cin>>l>>r;
            cout<<fw1.sum(l,r+1)<<" "<<fw2.sum(l,r+1)<<"\n";
            L[q]=L[q-1];
        }else{
            int m;
            cin>>m;
            L[q]=m;
        }
    }
    if(!flag)cout<<"Not Found!\n";
}
0