# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
205401 | oko | Wall (IOI14_wall) | C++14 | 631 ms | 34808 KiB |
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 <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "wall.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>mx[100005],mn[100005];
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
for(int i=0;i<k;i++)
{
int l=left[i],r=right[i],h=height[i];
if(op[i]==1)
{
mx[l].push_back(h);
mx[r+1].push_back(-h);
}
else
{
mn[l].push_back(h);
mn[r+1].push_back(-h);
}
}
multiset<int>ms;
ms.insert(0);
for(int i=0;i<n;i++)
{
for(int j=0;j<mx[i].size();j++)
{
int x=mx[i][j];
if(x>0)ms.insert(x);
else ms.erase(ms.lower_bound(-x));
}
finalHeight[i]=*--ms.end();
}
ms.clear();
for(int i=0;i<n;i++)
{
for(int j=0;j<mn[i].size();j++)
{
int x=mn[i][j];
if(x>0)ms.insert(-x);
else ms.erase(ms.lower_bound(x));
}
if(ms.size()==0)continue;
int z=*ms.begin();
finalHeight[i]=min(finalHeight[i],z);
}
}
Compilation message (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... |