#include<bits/stdc++.h>
#include "wall.h"
#define ll long long
#define f first
#define s second
using namespace std;
const int maxn=2e6+5;
int N,Q;
vector<pair<int,int>> sta[maxn];
int resavaj(vector<pair<int,int>> V){
int minr=1e9,res=0;
for(int i=V.size()-1;i>=0;i--){
if(V[i].f==2)
minr=min(minr,V[i].s);
else
res=max(res,min(V[i].s,minr));
}
/*
int h=0;
for(auto x:V){
if(x.first==1)
h=max(h,x.second);
else
h=min(h,x.second);
}
// cout<<h<<endl;
if(h!=res)
cout<<"LOSE"<<endl;*/
//cout<<h<<" "<<res<<endl;
// cout<<v1<<" "<<v2<<endl;
return res;
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
N=n;
Q=k;
for(int i=0;i<Q;i++){
for(int j=left[i];j<=right[i];j++)
sta[j].push_back({op[i],height[i]});
}
for(int i=0;i<N;i++){
// cout<<"I je "<<i<<endl;
finalHeight[i]=resavaj(sta[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
47196 KB |
Output is correct |
2 |
Correct |
20 ms |
47584 KB |
Output is correct |
3 |
Correct |
21 ms |
49244 KB |
Output is correct |
4 |
Correct |
308 ms |
238280 KB |
Output is correct |
5 |
Correct |
311 ms |
223268 KB |
Output is correct |
6 |
Correct |
318 ms |
223664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
47352 KB |
Output is correct |
2 |
Correct |
100 ms |
63164 KB |
Output is correct |
3 |
Runtime error |
301 ms |
262144 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
47192 KB |
Output is correct |
2 |
Correct |
15 ms |
47452 KB |
Output is correct |
3 |
Correct |
17 ms |
49300 KB |
Output is correct |
4 |
Correct |
294 ms |
238436 KB |
Output is correct |
5 |
Correct |
264 ms |
223628 KB |
Output is correct |
6 |
Correct |
293 ms |
223588 KB |
Output is correct |
7 |
Correct |
15 ms |
47196 KB |
Output is correct |
8 |
Correct |
132 ms |
63116 KB |
Output is correct |
9 |
Runtime error |
329 ms |
262144 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
47368 KB |
Output is correct |
2 |
Correct |
18 ms |
47560 KB |
Output is correct |
3 |
Correct |
16 ms |
49240 KB |
Output is correct |
4 |
Correct |
295 ms |
238264 KB |
Output is correct |
5 |
Correct |
270 ms |
223324 KB |
Output is correct |
6 |
Correct |
269 ms |
223568 KB |
Output is correct |
7 |
Correct |
16 ms |
47196 KB |
Output is correct |
8 |
Correct |
107 ms |
63184 KB |
Output is correct |
9 |
Runtime error |
312 ms |
262144 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |