# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
284136 |
2020-08-26T22:35:43 Z |
Ozy |
벽 (IOI14_wall) |
C++17 |
|
1 ms |
512 KB |
#include "wall.h"
#include <bits/stdc++.h>
#define lli long long int
#define rep(i,a,b) for (lli i = (a); i <= (b); i++)
#define MIN -100001
using namespace std;
struct x{
lli pos;
lli tipo;
lli val;
bool operator < (const x &a)
const {
return pos < a.pos;
}
};
set<lli> set1,set2;
vector<x> sum,res;
lli cant1[100002],cant2[100002];
lli cont1,cont2,a,b;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
rep (i,0,k-1) {
if (op[i] == 1) {
//agrega
sum.push_back({left[i],1,height[i]});
sum.push_back({right[i]+1,0,height[i]});
}
else {
//quita
res.push_back({left[i],1,height[i]});
res.push_back({right[i]+1,0,height[i]});
}
}
cont1 = 0;
cont2 = 0;
rep(i,0,n-1) {
while (sum[cont1].pos == i) {
if (sum[cont1].tipo == 1) {
cant1[sum[cont1].val] ++;
set1.insert(-(sum[cont1].val));
}
else {
cant1[sum[cont1].val]--;
if (cant1[sum[cont1].val] == 0) set1.erase(-(sum[cont1].val));
}
cont1++;
}
while (res[cont2].pos == i) {
if (res[cont2].tipo == 1) {
cant2[res[cont2].val] ++;
set2.insert(-(res[cont2].val));
}
else {
cant2[res[cont2].val]--;
if (cant2[res[cont2].val] == 0) set1.erase(-(res[cont2].val));
}
cont1++;
}
if (set1.lower_bound(MIN) != set1.end()) a = abs(*set1.lower_bound(MIN));
else a = 0;
if (set2.lower_bound(MIN) != set2.end()) b = abs(*set2.lower_bound(MIN));
else b = 0;
finalHeight[i] = min(a,b);
}
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |