QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#532427#1147. WallWansur0 73ms13784kbC++231.3kb2024-08-25 03:43:512024-08-25 03:43:52

Judging History

你现在查看的是最新测评结果

  • [2024-08-25 03:43:52]
  • 评测
  • 测评结果:0
  • 用时:73ms
  • 内存:13784kb
  • [2024-08-25 03:43:51]
  • 提交

answer

#include <bits/stdc++.h>
#include "wall.h"

using namespace std;
typedef long long ll;
const int maxn = 2000000;

int mx[maxn*4], mn[maxn*4];
int p[maxn*4];

void push(int v, int tl, int tr){
    if(tl == tr || p[v] == -1) return;
    mx[v*2] = mx[v*2+1] = p[v];
    mn[v*2] = mn[v*2+1] = p[v];
    p[v*2] = p[v*2+1] = p[v];
    p[v] = -1;
}

void upd(int v, int tl, int tr, int l, int r, int x, int tp){
    push(v, tl, tr);
    if(tl > r || l > tr || tp == 1 && mn[v] >= x || tp == 2 && mx[v] <= x) return;
    if(tl >= l && tr <= r){
        mx[v] = mn[v] = x;
        p[v] = x;
        return;
    }
    int mid = tl + tr >> 1;
    upd(v*2, tl, mid, l, r, x, tp);
    upd(v*2+1, mid+1, tr, l, r, x, tp);
    mx[v] = max(mx[v*2], mx[v*2+1]);
    mn[v] = min(mn[v*2], mn[v*2+1]);
}

int get(int v, int tl, int tr, int pos){
    push(v, tl, tr);
    if(tl == tr){
        return mx[v];
    }
    int mid = tl + tr >> 1;
    if(pos <= mid) return get(v*2, tl, mid, pos);
    return get(v*2+1, mid+1, tr, pos);
}

void buildWall(int n, int k, int op[], int l[], int r[], int h[], int ans[]){
    for(int i=0;i<n*4;i++){
        p[i] = -1;
    }
    for(int i=0;i<k;i++){
        upd(1, 0, n-1, l[i], r[i], h[i], op[i]);
    }
    for(int i=0;i<n;i++){
        ans[i] = get(1, 0, n-1, i);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 1ms
memory: 6000kb

input:

1 1
1 0 0 79348

output:

79348

result:

ok single line: '79348'

Test #2:

score: 8
Accepted
time: 0ms
memory: 4000kb

input:

1 5000
2 0 0 91858
1 0 0 85391
2 0 0 5015
1 0 0 41611
1 0 0 42982
1 0 0 70801
1 0 0 14431
2 0 0 14050
2 0 0 70240
2 0 0 84517
1 0 0 42618
1 0 0 92678
1 0 0 63376
1 0 0 36582
2 0 0 39214
2 0 0 22581
2 0 0 10970
1 0 0 67580
2 0 0 44016
2 0 0 12053
1 0 0 42450
1 0 0 12995
2 0 0 71888
2 0 0 29992
2 0 0 ...

output:

18711

result:

ok single line: '18711'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 6044kb

input:

267 1952
1 30 144 71757
1 170 257 86481
2 112 115 42915
2 11 144 6908
1 141 161 3819
1 91 126 47581
1 107 149 6466
2 81 204 50010
1 9 103 77557
2 115 202 42541
2 199 230 18052
2 98 230 553
1 125 235 36745
2 59 114 71005
1 18 65 78224
2 24 52 21249
1 16 84 47198
1 131 207 81016
2 162 263 21662
1 8 24...

output:

58284
58284
58284
58284
83411
83411
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
34807
...

result:

wrong answer 3rd lines differ - expected: '60534', found: '58284'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 24
Accepted
time: 1ms
memory: 5936kb

input:

1 1
1 0 0 51569

output:

51569

result:

ok single line: '51569'

Test #8:

score: 24
Accepted
time: 73ms
memory: 13784kb

input:

1 500000
1 0 0 92201
1 0 0 88187
1 0 0 78173
1 0 0 57498
1 0 0 95946
1 0 0 72895
1 0 0 46122
1 0 0 67752
1 0 0 45557
1 0 0 46888
1 0 0 84250
1 0 0 24947
1 0 0 30575
1 0 0 54171
1 0 0 80874
1 0 0 81939
1 0 0 88805
1 0 0 71685
1 0 0 28774
1 0 0 33813
1 0 0 41164
1 0 0 78447
1 0 0 85126
1 0 0 30919
1 0...

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Wrong Answer
time: 37ms
memory: 9728kb

input:

18190 207265
1 1435 13396 14900
1 6250 8319 35530
1 7963 12194 50416
1 8286 12081 65629
1 11253 17172 87794
1 9886 16510 63411
1 2728 11446 61035
1 14426 17678 41533
1 2545 7233 6656
1 2158 8796 66853
1 10860 14353 55751
1 4751 14591 72745
1 6971 7654 82848
1 5292 15990 14033
1 10090 16771 27152
1 4...

output:

15148
15148
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
840
...

result:

wrong answer 178th lines differ - expected: '113', found: '840'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%