結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2024-10-18 23:15:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,653 ms / 6,000 ms
コード長 776 bytes
コンパイル時間 4,800 ms
コンパイル使用メモリ 266,108 KB
実行使用メモリ 14,680 KB
最終ジャッジ日時 2024-10-18 23:16:11
合計ジャッジ時間 20,921 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
14,672 KB
testcase_01 AC 8 ms
14,572 KB
testcase_02 AC 7 ms
14,536 KB
testcase_03 AC 7 ms
14,512 KB
testcase_04 AC 7 ms
14,644 KB
testcase_05 AC 8 ms
14,572 KB
testcase_06 AC 7 ms
14,612 KB
testcase_07 AC 7 ms
14,512 KB
testcase_08 AC 9 ms
14,596 KB
testcase_09 AC 8 ms
14,540 KB
testcase_10 AC 8 ms
14,652 KB
testcase_11 AC 568 ms
14,680 KB
testcase_12 AC 1,368 ms
14,600 KB
testcase_13 AC 1,398 ms
14,612 KB
testcase_14 AC 567 ms
14,512 KB
testcase_15 AC 372 ms
14,540 KB
testcase_16 AC 1,267 ms
14,576 KB
testcase_17 AC 226 ms
14,652 KB
testcase_18 AC 932 ms
14,516 KB
testcase_19 AC 1,653 ms
14,532 KB
testcase_20 AC 326 ms
14,620 KB
testcase_21 AC 898 ms
14,632 KB
testcase_22 AC 940 ms
14,556 KB
testcase_23 AC 564 ms
14,624 KB
testcase_24 AC 6 ms
14,600 KB
testcase_25 AC 7 ms
14,528 KB
testcase_26 AC 1,262 ms
14,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
struct S {
	ll a;
	ll b;
};
S op(S a, S b) {
	return S{a.a + b.a, a.b + b.b};
}
S e() {
	return S{0, 0};
}
int main () {
	int N, Q, L0;
	cin >> N >> Q >> L0;
	std::vector<S> V(200020, e());
	for (int i = 0; i < N; i ++) {
		int a;
		cin >> a;
		V[a].a ++;
		V[a].b += a;
	}
	bool nf = false;
	segtree<S, op, e> sg(V);
	while (Q--) {
		int t;
		cin >> t;
		nf = nf || (t == 2);
		if (t == 1) {
			int x;
			cin >> x;
			V[x].a ++;
			V[x].b += x;
			sg.set(x, V[x]);
		} else if (t == 2) {
			int l, r;
			cin >> l >> r;
			auto [p, q] = sg.prod(l, r + 1);
			cout << p << " " << q << endl;
		} else {
			cin >> L0;
		}
	}
	if (!nf) {
		puts("Not Found!");
	}
}
0