Submission #287071

# Submission time Handle Problem Language Result Execution time Memory
287071 2020-08-31T11:25:25 Z Atill83 Wall (IOI14_wall) C++14
8 / 100
3000 ms 88400 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++){
        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 29 ms 47360 KB Output is correct
2 Correct 36 ms 47736 KB Output is correct
3 Correct 33 ms 47360 KB Output is correct
4 Correct 239 ms 47952 KB Output is correct
5 Correct 161 ms 47864 KB Output is correct
6 Correct 162 ms 47864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 47224 KB Output is correct
2 Correct 347 ms 88400 KB Output is correct
3 Execution timed out 3036 ms 60072 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 47232 KB Output is correct
2 Correct 32 ms 47636 KB Output is correct
3 Correct 33 ms 47360 KB Output is correct
4 Correct 235 ms 47864 KB Output is correct
5 Correct 161 ms 47872 KB Output is correct
6 Correct 162 ms 47860 KB Output is correct
7 Correct 29 ms 47328 KB Output is correct
8 Correct 338 ms 88284 KB Output is correct
9 Execution timed out 3038 ms 60176 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 47232 KB Output is correct
2 Correct 33 ms 47736 KB Output is correct
3 Correct 33 ms 47412 KB Output is correct
4 Correct 235 ms 47848 KB Output is correct
5 Correct 176 ms 47900 KB Output is correct
6 Correct 175 ms 47880 KB Output is correct
7 Correct 35 ms 47232 KB Output is correct
8 Correct 349 ms 88284 KB Output is correct
9 Execution timed out 3051 ms 59972 KB Time limit exceeded
10 Halted 0 ms 0 KB -