# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40640 | IvanC | Sterilizing Spray (JOI15_sterilizing) | C++14 | 350 ms | 40528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 10;
ll seg[4*MAXN],qtd[4*MAXN],vetor[MAXN],N,Q,K;
void build(int pos,int left,int right){
if(left == right){
seg[pos] = vetor[left];
qtd[pos] = (seg[pos] == 0);
return;
}
int mid = (left+right)/2;
build(2*pos,left,mid);
build(2*pos+1,mid+1,right);
seg[pos] = seg[2*pos] + seg[2*pos+1];
qtd[pos] = qtd[2*pos] + qtd[2*pos+1];
}
void update_division(int pos,int left,int right,int i,int j){
if(qtd[pos] == right - left + 1) return;
if(left == right){
seg[pos] = seg[pos]/K;
qtd[pos] = (seg[pos] == 0);
return;
}
int mid = (left+right)/2;
if(j <= mid){
update_division(2*pos,left,mid,i,j);
}
else if(i >= mid+1){
update_division(2*pos+1,mid+1,right,i,j);
# | 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... |