이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
map<int,vector<int>> beg,end;
set<int> low,high;
for(int i=0; i<k; i++){
beg[left[i]].push_back(i);
end[right[i]+1].push_back(i);
}
for(int i=0; i<n; i++){
for(auto j:beg[i]){
if(op[j]==1) low.insert(height[j]);
else high.insert(height[j]);
}
for(auto j:end[i]){
if(op[j]==1) low.erase(low.find(height[j]));
else high.erase(high.find(height[j]));
}
finalHeight[i]=min(low.empty()?0:*next(low.end(),-1), high.empty()?1000000:*(high.begin()));
}
}
| # | 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... |