Submission #92566

# Submission time Handle Problem Language Result Execution time Memory
92566 2019-01-03T13:55:03 Z maruii Wall (IOI14_wall) C++17
0 / 100
263 ms 8184 KB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1<<21;
int *fin;
struct ST{
    int mn[2*SIZE], mx[2*SIZE];
    void update(int nn, int ns, int ne, int s, int e, int x, int q){
        if(ns>e || ne<s) return;
        if(s<=ns && ne<=e){
            if(q==1)
                mn[nn] = mx[nn] = max(mn[nn], x);
            else if(q==2)
                mx[nn] = mn[nn] = min(mn[nn], x);
            if(ns==ne) fin[ns] = mx[nn];
            return;
        }
        int m =(ns+ne)/2;
        int l = nn*2, r = l+1;
        mn[l] = min(mn[l], mn[nn]); mn[r] = min(mn[r], mn[nn]);
        mx[l] = min(mx[l], mn[nn]); mx[r] = min(mx[r], mn[nn]);
        mn[l] = max(mn[l], mx[nn]); mn[r] = max(mn[r], mx[nn]);
        mx[l] = max(mx[l], mx[nn]); mx[r] = max(mx[r], mx[nn]);
        mx[nn] = 0; mn[nn] = 1e9;
        update(l, ns, m, s, e, x, q);
        update(r, m+1, ne, s, e, x, q);
    }
}seg;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    fin = finalHeight;
    for(int i=0; i<k; ++i){
        seg.update(1, 0, n-1, left[i], right[i], height[i], op[i]);
    }
    for(int i=0; i<n; ++i)
        seg.update(1, 0, n-1, i, i, 0, 0);
    return;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 263 ms 8184 KB Output is correct
3 Incorrect 156 ms 4344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -