Submission #307480

# Submission time Handle Problem Language Result Execution time Memory
307480 2020-09-28T09:53:31 Z juggernaut Wall (IOI14_wall) C++14
100 / 100
801 ms 67064 KB
#include"wall.h"
#include<bits/stdc++.h>
using namespace std;
int flag[8000000][2];
int ans[2000000];
void app(int v,int mn,int mx){
    flag[v][0]=min(max(flag[v][0],mn),mx);
	flag[v][1]=min(max(flag[v][1],mn),mx);
}
void push(int v,int l,int r){
    if(l!=r){
        app(v<<1,flag[v][0],flag[v][1]);
        app((v<<1)+1,flag[v][0],flag[v][1]);
    }
    flag[v][0]=0;
    flag[v][1]=2e9;
}
void update(int v,int l,int r,int ql,int qr,int mn,int mx){
    if(ql<=l&&r<=qr){
        app(v,mn,mx);
        return;
    }
    if(r<ql||qr<l)return;
    push(v,l,r);
    int mid=(l+r)>>1;
    update(v<<1,l,mid,ql,qr,mn,mx);
    update((v<<1)+1,mid+1,r,ql,qr,mn,mx);
}
void build(int v,int l,int r){
    if(l==r){
        ans[l]=flag[v][1];
        return;
    }
    push(v,l,r);
    int mid=(l+r)>>1;
    build(v<<1,l,mid);
    build((v<<1)+1,mid+1,r);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){
    for(int i=0;i<k;i++){
        if(op[i]==1)update(1,0,n-1,left[i],right[i],height[i],2e9);
        else update(1,0,n-1,left[i],right[i],0,height[i]);
    }
    build(1,0,n-1);
    for(int i=0;i<n;i++)finalHeight[i]=ans[i];
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 6 ms 768 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 182 ms 8184 KB Output is correct
3 Correct 196 ms 4344 KB Output is correct
4 Correct 550 ms 11256 KB Output is correct
5 Correct 363 ms 11768 KB Output is correct
6 Correct 338 ms 11768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 184 ms 8184 KB Output is correct
9 Correct 194 ms 4344 KB Output is correct
10 Correct 547 ms 11256 KB Output is correct
11 Correct 354 ms 11740 KB Output is correct
12 Correct 341 ms 11768 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 183 ms 8184 KB Output is correct
15 Correct 32 ms 1536 KB Output is correct
16 Correct 542 ms 11512 KB Output is correct
17 Correct 353 ms 11512 KB Output is correct
18 Correct 347 ms 11512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 181 ms 8184 KB Output is correct
9 Correct 196 ms 4340 KB Output is correct
10 Correct 554 ms 11200 KB Output is correct
11 Correct 362 ms 11768 KB Output is correct
12 Correct 342 ms 11768 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 188 ms 8116 KB Output is correct
15 Correct 31 ms 1528 KB Output is correct
16 Correct 549 ms 11640 KB Output is correct
17 Correct 343 ms 11464 KB Output is correct
18 Correct 339 ms 11440 KB Output is correct
19 Correct 794 ms 67064 KB Output is correct
20 Correct 785 ms 64548 KB Output is correct
21 Correct 801 ms 66976 KB Output is correct
22 Correct 792 ms 64508 KB Output is correct
23 Correct 798 ms 64632 KB Output is correct
24 Correct 795 ms 64504 KB Output is correct
25 Correct 793 ms 64516 KB Output is correct
26 Correct 798 ms 67044 KB Output is correct
27 Correct 794 ms 66936 KB Output is correct
28 Correct 799 ms 64504 KB Output is correct
29 Correct 792 ms 64632 KB Output is correct
30 Correct 787 ms 64504 KB Output is correct