# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
572270 | SSRS | 돌 무게 재기 (IZhO11_stones) | C++14 | 227 ms | 3732 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000;
struct lazy_segment_tree{
int N;
vector<int> mn, mx, lazy;
lazy_segment_tree(int N2){
N = 1;
while (N < N2){
N *= 2;
}
mn = vector<int>(N * 2 - 1, INF);
mx = vector<int>(N * 2 - 1, -INF);
for (int i = 0; i < N2; i++){
mn[N - 1 + i] = 0;
mx[N - 1 + i] = 0;
}
for (int i = N - 2; i >= 0; i--){
mn[i] = min(mn[i * 2 + 1], mn[i * 2 + 2]);
mx[i] = max(mx[i * 2 + 1], mx[i * 2 + 2]);
}
lazy = vector<int>(N * 2 - 1, 0);
}
void eval(int i){
if (i < N - 1){
lazy[i * 2 + 1] += lazy[i];
lazy[i * 2 + 2] += lazy[i];
}
mn[i] += lazy[i];
mx[i] += lazy[i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |