結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー hourenhouren
提出日時 2024-10-18 22:57:42
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 473 ms / 6,000 ms
コード長 1,832 bytes
コンパイル時間 4,449 ms
コンパイル使用メモリ 275,640 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-18 22:58:49
合計ジャッジ時間 11,801 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,820 KB
testcase_01 AC 4 ms
6,816 KB
testcase_02 AC 4 ms
6,816 KB
testcase_03 AC 4 ms
6,816 KB
testcase_04 AC 5 ms
6,816 KB
testcase_05 AC 6 ms
6,816 KB
testcase_06 AC 4 ms
6,816 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 4 ms
6,816 KB
testcase_11 AC 170 ms
6,820 KB
testcase_12 AC 473 ms
6,820 KB
testcase_13 AC 425 ms
6,816 KB
testcase_14 AC 192 ms
6,816 KB
testcase_15 AC 150 ms
6,820 KB
testcase_16 AC 305 ms
6,816 KB
testcase_17 AC 79 ms
6,816 KB
testcase_18 AC 263 ms
6,816 KB
testcase_19 AC 400 ms
6,816 KB
testcase_20 AC 114 ms
6,820 KB
testcase_21 AC 364 ms
6,816 KB
testcase_22 AC 343 ms
6,816 KB
testcase_23 AC 124 ms
6,820 KB
testcase_24 AC 4 ms
6,816 KB
testcase_25 AC 4 ms
6,820 KB
testcase_26 AC 362 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);
template <typename T>
struct BIT{
    int n;
    vector<T> data;
    BIT(int n=0) : n(n), data(n+1){}
    T sum(int i){
        T res = 0;
        for(; i; i -= i&-i){
            res += data[i];
        }
        return res;
    }
    void add(int i, T x){
        for(; i <= n; i += i&-i){
            data[i] += x;
        }
    }
    int lower_bound(T w){
        int x = 0, r = 1;
        while(r<n) r <<= 1;
        for(int l=r;l>0;l>>=1){
            if(x+l<=n && data[x+l]<w){
                x += l;
                w -= data[x];
            }
        }
        return x+1;
    }
};
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,q,l;
    cin >> n >> q >> l;
    BIT<ll> cnt(200200), tot(200200);
    rep(i,n){
        int a;
        cin >> a;
        ++a;
        cnt.add(a,1);
        tot.add(a,a-1);
    }
    bool f = true;
    while(q--){
        int t;
        cin >> t;
        if(t==1){
            int a;
            cin >> a;
            ++a;
            cnt.add(a,1);
            tot.add(a,a-1);
        }else if(t==2){
            f = false;
            int x,y;
            cin >> x >> y;
            ++y;
            cout << cnt.sum(y)-cnt.sum(x) << " " << tot.sum(y)-tot.sum(x) << '\n';
        }else{
            cin >> l;
        }
    }
    if(f) cout << "Not Found!\n";
    return 0;
}
0