| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 723962 | kkts | Sterilizing Spray (JOI15_sterilizing) | C++14 | 1648 ms | 9284 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7; // !
int t[N], c[N], n;
void upd(int id, int v) {
for(id; id <= n; id += id & (-id)) t[id] += v;
}
int get(int id) {
int ans = 0;
for(id; id >= 1; id -= id & (-id)) ans += t[id];
return ans;
}
void update(int x, int v) {
if(c[x] == v) return;
upd(x, -c[x]);
c[x] = v;
upd(x, c[x]);
}
main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int q, k;
cin >> n >> q >> k;
set<int> s;
for(int i = 1; i <= n; i++) cin >> c[i], upd(i, c[i]), s.insert(i);
s.insert(n + 5);
for(int i = 1; i <= q; i++) {
int t, l, r;
cin >> t >> l >> r;
if(t == 1) {
update(l, r);
s.insert(l);
continue;
}
if(t == 2) {
int L = l - 1;
while(k > 1 && *s.upper_bound(L) <= r) {
int x = *s.upper_bound(L);
s.erase(x);
update(x, c[x] / k);
if(c[x] / k != c[x]) s.insert(x);
L = x;
}
} else cout << get(r) - get(l - 1) << "\n";
}
}
컴파일 시 표준 에러 (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... | ||||
