結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<int(n); i++)
const i64 INF = 1001001001001001001;
template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; }
template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; }
#include <atcoder/modint>
#include <atcoder/fenwicktree>
using Modint = atcoder::static_modint<998244353>;
using namespace std;

void testcase(){
    i64 N, Q, L0; cin >> N >> Q >> L0;
    i64 Z = 200001;
    atcoder::fenwick_tree<i64> C(Z+1), S(Z+1);
    rep(i,N){
        i64 a; cin >> a;
        C.add(a, 1);
        S.add(a, a);
    }
    i64 cnt_q2 = 0;
    rep(qi,Q){
        i64 t; cin >> t;
        if(t == 1){
            i64 l; cin >> l;
            C.add(l, 1);
            S.add(l, l);
        }
        if(t == 2){
            i64 l,r; cin >> l >> r;
            cout << C.sum(l,r+1) << " " << S.sum(l,r+1) << "\n";
            cnt_q2 += 1;
        }
        if(t == 3){
            i64 m; cin >> m;
            L0 = m;
        }
    }
    if(cnt_q2 == 0){ cout << "Not Found!\n"; }
}

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    testcase();
    return 0;
}
0