# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
725564 |
2023-04-17T16:33:10 Z |
allin27x |
Wall (IOI14_wall) |
C++17 |
|
135 ms |
8180 KB |
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
struct SGT{
int op;
vector<int> t;
int n;
SGT(int sz, int op1){
n= sz;
op = op1;
t.resize(2*n, -1);
}
void apply(int p, int x){
if (t[p]==-1) {t[p] = x; return;}
t[p] = abs(max(op*t[p], op*x));
}
void update(int l, int r, int x){
for (l+=n, r+=n+1; l<r; l>>=1, r>>=1){
if (l&1) apply(l++, x);
if (r&1) apply(--r, x);
}
}
void push(){
for (int i=1; i<n; i++){
if (t[i]==-1) continue;
apply(i<<1, t[i]);
apply(i<<1|1, t[i]);
}
}
};
void brute_force(int n, int k, int op[], int l[],int r[],int h[], int ans[]){
for (int i=0; i<k; i++){
for(int j=l[i]; j<=r[i]; j++){
if (op[i] == 1) ans[j] = max(ans[j] , h[i]);
if (op[i] == 2) ans[j] = min(ans[j] , h[i]);
}
}
}
void buildWall(int n, int k, int op[], int l[],int r[],int h[], int ans[]){
if (n<=10000) {brute_force(n,k,op,l,r,h, ans); return;}
SGT add(n, 1);
SGT rem(n, -1);
for (int i=0; i<k; i++){
if (op[i]==1) add.update(l[i], r[i], h[i]);
if (op[i]==2) rem.update(l[i], r[i], h[i]);
}
for (int i=0; i<n; i++) ans[i] = min(add.t[i+n], rem.t[i+n]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
22 ms |
468 KB |
Output is correct |
5 |
Correct |
25 ms |
400 KB |
Output is correct |
6 |
Correct |
31 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
133 ms |
8100 KB |
Output is correct |
3 |
Incorrect |
85 ms |
3892 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
23 ms |
412 KB |
Output is correct |
5 |
Correct |
24 ms |
392 KB |
Output is correct |
6 |
Correct |
28 ms |
392 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
134 ms |
8068 KB |
Output is correct |
9 |
Incorrect |
84 ms |
3900 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
23 ms |
540 KB |
Output is correct |
5 |
Correct |
26 ms |
412 KB |
Output is correct |
6 |
Correct |
31 ms |
400 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
135 ms |
8180 KB |
Output is correct |
9 |
Incorrect |
87 ms |
3888 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |