This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(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(it);
}
return;
}
/*
*/
# | 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... |