#include<bits/stdc++.h>
#include "wall.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=500090;
vector<int>v[N],vv[N];
multiset<int>s;
void buildWall(int n, int k, int op[], int l[], int r[], int h[], int a[]){
for(int i=0;i<k;i++)
{
if(op[i]==2)break;
v[l[i]].pb(h[i]);
vv[r[i]].pb(h[i]);
}
s.insert(0);
for(int i=0;i<n;i++)
{
for(auto it:v[i])
s.insert(it);
int x=*s.rbegin();
a[i]=max(a[i],x);
for(auto it:vv[i])
s.erase(s.find(it));
}
s.clear();
s.insert(1e9);
for(int i=0;i<n+1;i++){
v[i].clear();
vv[i].clear();
}
for(int i=0;i<k;i++)
{
if(op[i]==1)continue;
v[l[i]].pb(h[i]);
vv[r[i]].pb(h[i]);
}
for(int i=0;i<n;i++)
{
for(auto it:v[i])
s.insert(it);
int x=*s.begin();
a[i]=min(a[i],x);
for(auto it:vv[i])
s.erase(s.find(it));
}
return;
}
/*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
23756 KB |
Output is correct |
2 |
Incorrect |
18 ms |
23884 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
23760 KB |
Output is correct |
2 |
Correct |
709 ms |
52532 KB |
Output is correct |
3 |
Correct |
318 ms |
34340 KB |
Output is correct |
4 |
Correct |
1065 ms |
52172 KB |
Output is correct |
5 |
Correct |
353 ms |
51260 KB |
Output is correct |
6 |
Correct |
359 ms |
47432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
23756 KB |
Output is correct |
2 |
Incorrect |
16 ms |
23884 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
23708 KB |
Output is correct |
2 |
Incorrect |
16 ms |
23884 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |