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 "wall.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
const int MAXN = 500100;
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int ans[]){
//FOR(i, 0, n-1) ans[i] = height[i];
FOR(kk, 0, k-1) {
int le = left[kk], ri = right[kk];
int h = height[kk];
if (op[kk] == 1)
FOR(i, le, ri)
ans[i] = max(ans[i], h);
else
FOR(i, le, ri)
ans[i] = min(ans[i], h);
}
return;
}
/*
###
in:
10 3
1 3 4 91220
1 5 9 48623
2 3 5 39412
ans:
0
0
0
39412
39412
39412
48623
48623
48623
48623
###
in:
10 6
1 1 8 4
2 4 9 1
2 3 6 5
1 0 5 3
1 2 2 5
2 6 7 0
ans:
3
4
5
4
3
3
0
0
1
0
*/
# | 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... |