답안 #1113657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113657 2024-11-17T00:48:47 Z sunboi 벽 (IOI14_wall) C++17
61 / 100
405 ms 47688 KB
#include <bits/stdc++.h>
using namespace std;


const int N = 2e5 + 1000;
vector<int> a(N);
vector<pair<long long, long long>> t(4 * N);

void push(int v, int vl, int vr){
    if (vr != vl){
         t[2 * v].first = min(max(t[2 * v].first, t[v].first), t[v].second);
    
        t[2 * v ].second = max(min(t[2 * v].second, t[v].second), t[v].first);
     
        t[2 * v + 1].first = min(max(t[2 * v + 1].first, t[v].first), t[v].second);
        
        t[2 * v + 1].second = max(min(t[2 * v + 1].second, t[v].second), t[v].first);
        
        t[v] = {0, 1e9};
    }
    
   
}




void update(int v, int vl, int vr, int l, int r, long long x, int tt){
    if (vl > r || vr < l) return;
    
    push(v, vl ,vr);
    if (vl >= l && vr <= r){
        if (tt == 1){
            t[v] = {max(t[v].first, x), max(t[v].second, x)};
        }else{
            t[v] = {min(t[v].first, x), min(t[v].second, x)};
        }
        push(v, vl ,vr);
        
        return;
    }
    
    int vm = (vl + vr) / 2;
    
    update(2 * v, vl, vm, l, r, x, tt);
    update(2 * v + 1, vm + 1, vr, l, r, x, tt);

}


int get(int v, int vl, int vr, int x){
    if (vl > x || vr < x) return -1;
    push(v, vl ,vr);
    if (vr == x && x == vl){
        return t[v].first;
    }
    
    
    int vm = (vl + vr) / 2;
    
    return max(get(2 * v, vl, vm, x), get(2 * v + 1, vm + 1, vr, x));
    
}

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){

    for (int i = 0; i < k; i++){
        update(1, 0, n - 1, left[i], right[i], height[i], op[i]);
    }
    for (int i = 0; i < n; i++){
        finalHeight[i] = get(1, 0, n - 1, i);
    }

}

# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 13648 KB Output is correct
2 Correct 4 ms 13648 KB Output is correct
3 Correct 4 ms 13816 KB Output is correct
4 Correct 9 ms 13904 KB Output is correct
5 Correct 7 ms 13932 KB Output is correct
6 Correct 7 ms 13904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 13648 KB Output is correct
2 Correct 85 ms 21416 KB Output is correct
3 Correct 127 ms 17084 KB Output is correct
4 Correct 369 ms 22088 KB Output is correct
5 Correct 209 ms 22512 KB Output is correct
6 Correct 211 ms 22600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 13648 KB Output is correct
2 Correct 3 ms 13648 KB Output is correct
3 Correct 3 ms 13648 KB Output is correct
4 Correct 7 ms 13904 KB Output is correct
5 Correct 8 ms 13904 KB Output is correct
6 Correct 7 ms 13904 KB Output is correct
7 Correct 3 ms 13648 KB Output is correct
8 Correct 85 ms 21424 KB Output is correct
9 Correct 154 ms 16968 KB Output is correct
10 Correct 390 ms 22092 KB Output is correct
11 Correct 226 ms 22600 KB Output is correct
12 Correct 216 ms 22512 KB Output is correct
13 Correct 3 ms 13648 KB Output is correct
14 Correct 90 ms 21456 KB Output is correct
15 Correct 24 ms 14416 KB Output is correct
16 Correct 398 ms 22424 KB Output is correct
17 Correct 213 ms 22472 KB Output is correct
18 Correct 208 ms 22480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 13648 KB Output is correct
2 Correct 4 ms 13648 KB Output is correct
3 Correct 4 ms 13648 KB Output is correct
4 Correct 8 ms 13964 KB Output is correct
5 Correct 7 ms 13932 KB Output is correct
6 Correct 8 ms 13924 KB Output is correct
7 Correct 3 ms 13648 KB Output is correct
8 Correct 87 ms 21576 KB Output is correct
9 Correct 137 ms 16968 KB Output is correct
10 Correct 405 ms 22040 KB Output is correct
11 Correct 247 ms 22720 KB Output is correct
12 Correct 211 ms 22600 KB Output is correct
13 Correct 3 ms 13648 KB Output is correct
14 Correct 104 ms 21576 KB Output is correct
15 Correct 25 ms 14416 KB Output is correct
16 Correct 399 ms 22344 KB Output is correct
17 Correct 212 ms 22480 KB Output is correct
18 Correct 201 ms 22344 KB Output is correct
19 Runtime error 131 ms 47688 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -