이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include "wall.h"
#include <set>
using namespace std;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
if(n <= 10000 && k <= 5000){
vector<int> heightl (n, 0);
for(int update = 0; update < k; update++){
for(int setter = left[update]; setter <= right[update]; setter++){
if(op[update] == 1) heightl[setter] = max(heightl[setter], height[update]);
else heightl[setter] = min(heightl[setter], height[update]);
}
}
for(int finisher = 0; finisher < n; finisher++) finalHeight[finisher] = heightl[finisher];
}
vector<vector<int>> adds (n);
vector<vector<int>> adde (n+1);
vector<vector<int>> subs (n);
vector<vector<int>> sube (n+1);
for(int update = 0; update < k; update++){
if(op[update] == 1){
adds[left[update]].push_back(height[update]);
adde[right[update]+1].push_back(height[update]);
}
else{
subs[left[update]].push_back(height[update]);
sube[right[update]+1].push_back(height[update]);
}
}
vector<int> mad (n, 0);
multiset<int, greater<>> b;
for(int madder = 0; madder < n; madder++){
for(int ins : adds[madder]) b.insert(ins);
for(int rm : adde[madder]) b.erase(rm);
mad[madder] = *(b.begin());
}
vector<int> msu (n, 0);
multiset<int> s;
for(int madder = 0; madder < n; madder++){
for(int ins : subs[madder]) s.insert(ins);
for(int rm : sube[madder]) s.erase(rm);
msu[madder] = *(s.begin());
}
for(int finisher = 0; finisher < n; finisher++) finalHeight[finisher] = min(mad[finisher], msu[finisher]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |