結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー shobonvipshobonvip
提出日時 2024-10-18 21:35:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 390 ms / 6,000 ms
コード長 1,740 bytes
コンパイル時間 4,761 ms
コンパイル使用メモリ 265,048 KB
実行使用メモリ 14,168 KB
最終ジャッジ日時 2024-10-18 22:23:44
合計ジャッジ時間 11,973 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,816 KB
testcase_02 AC 3 ms
6,816 KB
testcase_03 AC 5 ms
6,816 KB
testcase_04 AC 5 ms
6,820 KB
testcase_05 AC 4 ms
6,816 KB
testcase_06 AC 4 ms
6,816 KB
testcase_07 AC 4 ms
6,820 KB
testcase_08 AC 5 ms
6,824 KB
testcase_09 AC 5 ms
6,820 KB
testcase_10 AC 5 ms
6,816 KB
testcase_11 AC 168 ms
11,080 KB
testcase_12 AC 363 ms
12,480 KB
testcase_13 AC 329 ms
8,448 KB
testcase_14 AC 212 ms
12,376 KB
testcase_15 AC 151 ms
12,924 KB
testcase_16 AC 296 ms
7,680 KB
testcase_17 AC 85 ms
8,960 KB
testcase_18 AC 229 ms
9,088 KB
testcase_19 AC 390 ms
9,472 KB
testcase_20 AC 126 ms
10,556 KB
testcase_21 AC 367 ms
14,168 KB
testcase_22 AC 358 ms
14,152 KB
testcase_23 AC 127 ms
7,936 KB
testcase_24 AC 4 ms
6,816 KB
testcase_25 AC 4 ms
6,820 KB
testcase_26 AC 376 ms
14,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
	author:  shobonvip
	created: 2024.10.18 21:21:22
**/

#include<bits/stdc++.h>
using namespace std;

//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/

/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/

typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, q; cin >> n >> q;
	ll l0; cin >> l0;
	vector<ll> a(n);
	rep(i,0,n) {
		cin >> a[i];
	}
	fenwick_tree<ll> bit1(200002);
	fenwick_tree<ll> bit2(200002);
	rep(i,0,n){
		bit1.add(a[i], 1);
		bit2.add(a[i], a[i]);
	}

	bool mode = 0;
	while(q--){
		int t; cin >> t;
		if (t == 1){
			int l; cin >> l;
			bit1.add(l, 1);
			bit2.add(l, l);
		}else if(t == 2){
			int l, r; cin >> l >> r;
			r++;
			ll x = bit1.sum(l, r);
			ll y = bit2.sum(l, r);
			cout << x << ' ' << y << '\n';
			mode = 1;
		}else{
			ll l ; cin >> l;
		}
	}

	if (!mode){
		cout << "Not Found!\n";
	}
}

0