# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
694941 | Do_you_copy | Sterilizing Spray (JOI15_sterilizing) | C++17 | 183 ms | 10224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define int long long
using namespace std;
using ll = long long;
using pii = pair <int, int>;
mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e5 +1;
const int inf = 0x3f3f3f3f;
//const int Mod =
int n, q, k;
ll bit[maxN];
map <int, int> mp;
void update(int x, int v){
for (; x <= n; x += x & -x){
bit[x] += v;
}
}
int get(int x){
int res = 0;
for (; x; x -= x & -x){
res += bit[x];
}
return res;
}
void Init(){
cin >> n >> q >> k;
for (int i = 1; i <= n; ++i){
cin >> mp[i];
update(i, mp[i]);
}
mp[n + 1] = 0;
while (q--){
int s, t, u;
cin >> s >> t >> u;
if (s == 1){
update(t, u - mp[t]);
mp[t] = u;
}
if (s == 2 && k != 1){
for (auto it = mp.lower_bound(t); it->fi <= u;){
auto it1 = it++;
int x = it1->se;
it1->se /= k;
update(it1->fi, it1->se - x);
if (it1->se == 0){
mp.erase(it1);
}
}
}
if (s == 3){
cout << get(u) - get(t - 1) << "\n";
}
}
}
#define taskname "test"
signed main(){
faster
if (fopen(taskname ".inp", "r")){
freopen(taskname ".inp", "r", stdin);
freopen(taskname ".out", "w", stdout);
}
int tt = 1;
//cin >> tt;
while (tt--){
Init();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |