#include "wall.h"
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int ans[]){
vector<vector<int>> rig(n), lef(n);
for(int i = 0; i < k; i ++){
if(op[i] == 1) rig[right[i]].push_back(height[i]), lef[left[i]].push_back(height[i]);
}
multiset<int> st;
for(int i = 0; i < n; i ++){
for(auto h : lef[i]){
st.insert(h);
}
ans[i] = (st.empty() ? 0 : *st.rbegin());
for(auto h : rig[i]) st.erase(st.find(h));
}
rig.clear(); lef.clear();
for(int i = 0; i < k; i ++){
if(op[i] == 2) rig[right[i]].push_back(height[i]), lef[left[i]].push_back(height[i]);
}
for(int i = 0; i < n; i ++){
for(auto h : lef[i]){
st.insert(h);
}
ans[i] = min(ans[i], (st.empty() ? inf : *st.begin()));
for(auto h : rig[i]) st.erase(st.find(h));
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |