# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
164154 | kostia244 | Wall (IOI14_wall) | C++17 | 315 ms | 12248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wall.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
void buildWall(int n, int k, int op[], int l[], int r[], int h[], int fh[]){
if(n <= 5000) {
for(int i = 0; i < k; i++) {
if(op[i]==1) {
for(int p = l[i]; p <= r[i]; p++)
if(fh[p]<h[i]) fh[p] = h[i];
} else {
for(int p = l[i]; p <= r[i]; p++)
if(fh[p]>h[i]) fh[p] = h[i];
}
}
return;
}
vector<pair<int, int>> o[2][2];
for(int i = 0; i < k; i++) {
o[op[i]-1][0].pb({l[i], h[i]});
o[op[i]-1][1].pb({r[i]+1, h[i]});
}
for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) sort(all(o[i][j]));
int xa, xb, ya, yb;
xa=xb=ya=yb=0;
multiset<int, greater<int>> x;
multiset<int> y;
for(int i = 0; i < n; i++) {
while(xa<o[0][0].size()&&o[0][0][xa].first==i) {
x.insert(o[0][0][xa].second);
xa++;
}
while(xb<o[0][1].size()&&o[0][1][xb].first==i) {
x.erase(x.find(o[0][0][xb].second));
xb++;
}
while(ya<o[1][0].size()&&o[1][0][ya].first==i) {
y.insert(o[1][0][ya].second);
ya++;
}
while(yb<o[1][1].size()&&o[1][1][yb].first==i) {
y.erase(y.find(o[1][0][yb].second));
yb++;
}
fh[i] = min(x.empty()?0:*x.begin(), y.empty()?INT_MAX:*y.begin());
}
return;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |