Submission #287081

# Submission time Handle Problem Language Result Execution time Memory
287081 2020-08-31T11:35:33 Z Atill83 Wall (IOI14_wall) C++14
8 / 100
3000 ms 83036 KB
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
const int MAXN = (int) 2e6 + 5;
typedef pair<int, int> pii;
vector<int> yer[MAXN];
set<int> st;

void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    for(int i = 0; i < n; i++)
        finalHeight[i] = 0;

    for(int i = 0; i < k; i++){
        yer[left[i]].push_back(i + 1);
        yer[right[i] + 1].push_back(-(i + 1));
    }

    for(int i = 0; i < n; i++){
        if(yer[i].size() == 0){
            if(i == 0) 
                finalHeight[i] = 0;
            else
                finalHeight[i] = finalHeight[i - 1];
            continue;
        }
        for(int j: yer[i]){
            if(j < 0) st.erase(-(j + 1));
            else st.insert(j - 1);
        }
        int cur = 0;
        for(int j: st){
            if(op[j] == 1)
                cur = max(cur, height[j]);
            else
                cur = min(cur, height[j]);
        }
        finalHeight[i] = cur;
    }

    return;
}
# Verdict Execution time Memory Grader output
1 Correct 32 ms 47224 KB Output is correct
2 Correct 36 ms 47744 KB Output is correct
3 Correct 36 ms 47360 KB Output is correct
4 Correct 171 ms 47864 KB Output is correct
5 Correct 105 ms 47864 KB Output is correct
6 Correct 107 ms 47864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 47232 KB Output is correct
2 Correct 340 ms 82880 KB Output is correct
3 Execution timed out 3103 ms 56696 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 47232 KB Output is correct
2 Correct 36 ms 47744 KB Output is correct
3 Correct 36 ms 47360 KB Output is correct
4 Correct 169 ms 47896 KB Output is correct
5 Correct 103 ms 47864 KB Output is correct
6 Correct 104 ms 47876 KB Output is correct
7 Correct 32 ms 47352 KB Output is correct
8 Correct 341 ms 83036 KB Output is correct
9 Execution timed out 3100 ms 56696 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 47232 KB Output is correct
2 Correct 34 ms 47672 KB Output is correct
3 Correct 36 ms 47352 KB Output is correct
4 Correct 175 ms 47860 KB Output is correct
5 Correct 102 ms 47864 KB Output is correct
6 Correct 107 ms 47864 KB Output is correct
7 Correct 33 ms 47232 KB Output is correct
8 Correct 341 ms 82848 KB Output is correct
9 Execution timed out 3083 ms 56676 KB Time limit exceeded
10 Halted 0 ms 0 KB -