結果
| 問題 |
No.2942 Sigma Music Game Level Problem
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2024-10-18 21:35:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 455 ms / 6,000 ms |
| コード長 | 1,740 bytes |
| コンパイル時間 | 4,158 ms |
| コンパイル使用メモリ | 253,036 KB |
| 最終ジャッジ日時 | 2025-02-24 20:31:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
/**
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";
}
}
shobonvip