QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#411811#8672. 排队hcywoi30 203ms22232kbC++204.3kb2024-05-15 19:54:592024-05-16 17:38:11

Judging History

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

  • [2024-05-16 17:38:11]
  • 管理员手动重测本题所有提交记录
  • 测评结果:30
  • 用时:203ms
  • 内存:22232kb
  • [2024-05-15 19:54:59]
  • 评测
  • 测评结果:30
  • 用时:239ms
  • 内存:22088kb
  • [2024-05-15 19:54:59]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

template<class Info, class Tag>
struct LazySegmentTree {
	int n;
	std::vector<Info> info;
	std::vector<Tag> tag;
	LazySegmentTree() : n(0) {}
    LazySegmentTree(int n_, Info v_ = Info()) {
        init(n_, v_);
    }
	template<class T>
    LazySegmentTree(std::vector<T> init_) {
        init(init_);
    }
    void init(int n_, Info v_ = Info()) {
        init(std::vector(n_, v_));
    }
    template<class T>
    void init(std::vector<T> init_) {
        n = init_.size();
        info.assign(4 << std::__lg(n), Info());
        tag.assign(4 << std::__lg(n), Tag());
        std::function<void(int, int, int)> build = [&](int p, int l, int r) {
            if (l == r) {
                info[p] = init_[l];
                return;
            }
            int m = (l + r) / 2;
            build(p * 2, l, m);
            build(p * 2 + 1, m + 1, r);
            pull(p);
        };
        build(1, 0, n - 1);
    }

	void pull(int p) {
		info[p] = info[p * 2] + info[p * 2 + 1];
	}
	
	void apply(int p, const Tag& v) {
		info[p].apply(v);
		tag[p].apply(v);
	}
	
	void push(int p) {
		apply(p * 2, tag[p]);
		apply(p * 2 + 1, tag[p]);
		tag[p] = Tag();
	}

    void modify(int p, int l, int r, int x, const Info& v) {
        if (l == r) {
            info[p] = v;
            return;
        }

        int m = (l + r) / 2;
        push(p);
        if (x <= m) {
            modify(p * 2, l, m, x, v);
        } else {
            modify(p * 2 + 1, m + 1, r, x, v);
        }
        pull(p);
    }

    void modify(int p, const Info& v) {
        modify(1, 0, n - 1, p, v);
    }
	
	void modify(int p, int l, int r, int x, int y, const Tag& v) {
		if (l >= x && r <= y) {
			apply(p, v);
			return;
		}
		
		int m = (l + r) / 2;
		push(p);
		if (x <= m) {
			modify(p * 2, l, m, x, y, v);
		}
		if (y > m) {
			modify(p * 2 + 1, m + 1, r, x, y, v);
		}
		pull(p);
	}

	void modify(int l, int r, const Tag& v) {
		modify(1, 0, n - 1, l, r, v);
	}
	
	Info query(int p, int l, int r, int x, int y) {
		if (l >= x && r <= y) {
			return info[p];
		}
		
		int m = (l + r) / 2;
		push(p);
		
		Info info = Info();
		if (x <= m) {
			info = info + query(p * 2, l, m, x, y);
		}
		if (y > m) {
			info = info + query(p * 2 + 1, m + 1, r, x, y);
		}
		return info;
	}
	
	Info query(int l, int r) {
		return query(1, 0, n - 1, l, r);
	}

	int search(int p, int l, int r, int k) {
		if (l == r) {
			return l;
		}
		int m = (l + r) / 2;
		push(p);
		if (info[p * 2].min <= k) {
			return search(p * 2, l, m, k);
		} else {
			return search(p * 2 + 1, m + 1, r, k);
		}
	}

	int search(int k) {
		return search(1, 0, n - 1, k);
	}

	int search1(int p, int l, int r, int k) {
		if (l == r) {
			return l;
		}
		int m = (l + r) / 2;
		push(p);
		if (info[p * 2 + 1].max >= k) {
			return search(p * 2 + 1, m + 1, r, k);
		} else if (info[p * 2].max >= k) {
			return search(p * 2, l, m, k);
		}
		return -1;
	}

	int search1(int k) {
		return search1(1, 0, n - 1, k);
	}
};

struct Tag {
	int v = 0;
	void apply(const Tag& a) {
		v += a.v;
	}
};

constexpr int inf = 1E9;
struct Info {
	int max = -inf, min = inf;
	void apply(const Tag& a) {
		max += a.v;
		min += a.v;
	}
};

Info operator+ (Info a, Info b) {
	Info c;
	c.max = std::max(a.max, b.max);
	c.min = std::min(a.min, b.min);
	return c;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int n, q;
	std::cin >> n >> q;

	std::vector<int> l(n), r(n);
	for (int i = 0; i < n; i ++ ) {
		std::cin >> l[i] >> r[i];
		assert(l[i] >= 0);
		assert(l[i] <= n);
		assert(r[i] >= 0);
		assert(r[i] <= n);
	}

	std::vector<std::vector<std::pair<int, int>>> qry(n);
	for (int i = 0; i < q; i ++ ) {
		int l, r;
		std::cin >> l >> r;
		l --, r -- ;
		qry[r].emplace_back(l, i);
	}

	std::vector<int> ans(q);
	LazySegmentTree<Info, Tag> seg(n, {0, 0});
	for (int i = 0; i < n; i ++ ) {
		int L = seg.search(r[i]), R = std::min(i, seg.search1(l[i]));
		if (L <= R) {
			seg.modify(L, R, {1});
		}
		for (auto [l, x]: qry[i]) {
			ans[x] = seg.query(l, l).max;
		}
	}
	for (int i = 0; i < q; i ++ ) {
		std::cout << ans[i] << "\n";
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 3784kb

input:

3 3
0 0
1 2
0 2
1 1
1 3
2 3

output:

1
3
1

result:

ok 3 number(s): "1 3 1"

Test #2:

score: -10
Wrong Answer
time: 4ms
memory: 4004kb

input:

5000 5000
5 10
3 9
3 8
2 7
2 5
3 6
1 5
0 2
7 8
2 10
0 3
3 6
4 6
1 6
4 8
7 8
2 7
3 4
4 9
7 8
2 9
2 5
3 6
0 5
6 7
1 2
2 4
2 10
1 5
7 9
6 9
2 3
9 10
5 5
2 9
3 3
2 7
2 4
0 6
0 3
1 7
7 7
4 8
2 9
4 8
0 10
1 8
1 1
2 7
5 9
1 7
1 7
1 4
2 4
1 4
2 9
1 7
4 7
3 8
1 3
4 6
1 5
1 6
0 0
3 9
4 7
2 8
1 8
1 2
7 8
2 7
2...

output:

11
11
11
0
11
11
11
11
11
0
11
0
11
11
11
11
11
11
11
11
11
0
11
11
11
11
11
11
11
11
11
11
11
0
11
11
0
11
11
11
11
11
0
11
11
11
11
11
11
11
11
0
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
0
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
0
11
0
0
10
...

result:

wrong answer 4th numbers differ - expected: '11', found: '0'

Subtask #2:

score: 15
Accepted

Test #12:

score: 15
Accepted
time: 147ms
memory: 22180kb

input:

200000 200000
3 6
3 3
6 10
1 7
2 7
6 9
4 6
3 4
0 8
0 6
3 5
3 4
1 8
7 8
4 5
0 3
1 5
2 9
1 2
1 2
3 4
5 7
6 10
3 9
4 7
1 6
2 6
1 7
2 5
1 7
6 8
1 1
0 7
7 8
0 9
1 7
3 8
3 7
1 2
4 8
5 6
0 6
5 6
2 7
2 6
0 6
0 6
1 7
2 5
0 3
0 3
7 10
3 8
0 2
3 4
3 7
4 9
0 6
4 7
2 6
8 10
2 10
4 10
3 3
2 6
4 5
3 9
1 8
1 2
2 9
...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 200000 numbers

Test #13:

score: 0
Accepted
time: 144ms
memory: 22176kb

input:

200000 200000
5 45
27 99
7 23
51 88
16 62
10 24
16 80
43 70
12 45
35 55
6 99
77 91
40 82
66 99
30 47
18 80
9 36
4 12
26 51
37 64
39 52
2 11
2 69
57 81
15 98
8 36
19 27
32 34
35 97
22 23
15 89
53 77
2 89
25 55
25 90
4 91
13 77
37 65
67 89
8 52
20 58
10 18
31 81
35 59
41 56
71 74
18 61
56 77
51 74
40 ...

output:

101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
0
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 200000 numbers

Test #14:

score: 0
Accepted
time: 148ms
memory: 22232kb

input:

200000 200000
193 894
142 229
346 553
197 496
389 718
370 600
650 853
476 695
764 767
220 571
238 714
516 700
137 692
1 293
835 962
34 536
208 482
148 225
377 804
75 864
277 925
278 864
296 647
390 757
179 283
338 602
571 746
447 852
315 365
7 390
634 689
76 239
16 60
244 388
385 822
451 836
301 373...

output:

1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
961
999
1001
1001
1001
1001
1001
1001
981
1001
1001
1001
1001
1001
1001
1001
966
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 144ms
memory: 22084kb

input:

200000 200000
3145 7698
6037 6154
6483 6707
6834 7442
7373 9621
5166 8045
7346 8938
2235 5518
2240 4134
586 3188
3845 8054
1258 5380
2409 2631
3360 5706
19 2771
1925 9642
6687 8264
4305 8055
2844 5474
2282 7810
1738 4706
1462 7466
17 6282
2481 6022
2363 2987
3633 4157
1460 2634
4866 8159
3154 5079
2...

output:

9965
10001
0
10001
10001
10001
9991
10001
4831
9935
5274
10001
10001
2
10001
10001
10001
10001
9991
10001
10001
10001
10001
9935
9994
10001
9742
10001
10001
0
9982
10001
10001
10001
10001
10001
80
0
9991
9763
8
10001
9975
9939
10001
10001
9092
9983
9333
10001
10001
10001
10001
10001
10001
10001
9965...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 122ms
memory: 22176kb

input:

200000 200000
15540 44932
12196 33126
776 23774
35673 42863
31231 44618
16521 19781
8467 9747
5319 42216
13940 21955
3389 6981
22 11576
15248 17307
5734 35942
12762 45217
30349 47977
8869 11242
11199 25942
3415 10196
20104 40771
8813 28517
29726 34188
13420 13731
17526 30474
1033 44930
3143 10541
46...

output:

8
31
33781
8
161
3
618
14580
3
25947
1415
455
2
147
16877
21598
539
56
7425
6686
4
393
4
4
4378
176
24
1407
837
19
14
7146
7
19626
21422
9
20472
0
200
3514
2
380
35942
35129
1
216
3
312
1200
2519
4046
9
1734
1318
21862
3361
27414
52
38201
2303
635
235
1
17
271
24468
29
1029
1071
38200
10968
95
4
125...

result:

ok 200000 numbers

Test #17:

score: 0
Accepted
time: 151ms
memory: 21916kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 12
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 26
0 27
0 28
0 29
0 30
0 31
0 32
0 33
0 34
0 35
0 36
0 37
0 38
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 47
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 57
0 58
0 59
...

output:

74058
156458
175945
88572
145372
79026
163392
139232
188241
158454
17719
20452
171150
171343
104047
159458
132045
70328
136937
64711
174467
69614
125002
131739
81388
166709
80139
138489
34431
142820
179669
125831
148484
115982
184021
189596
73421
151270
194210
134276
117448
129846
127920
160607
1132...

result:

ok 200000 numbers

Test #18:

score: 0
Accepted
time: 150ms
memory: 21916kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 0
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 0
0 27
0 28
0 29
0 30
0 0
0 32
0 33
0 34
0 35
0 36
0 0
0 0
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 47
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 0
0 58
0 59
0 60
0...

output:

173310
165951
120854
142558
87420
163018
160623
76341
172338
95167
169845
31220
168100
132276
165092
84047
128575
138423
171800
154331
137251
163376
79848
167392
43722
41974
133487
110272
168461
91407
103766
57088
165360
154903
110464
80792
144277
102908
146051
175704
77052
168422
56979
126413
14964...

result:

ok 200000 numbers

Test #19:

score: 0
Accepted
time: 149ms
memory: 21844kb

input:

200000 200000
45 200000
27 200000
7 200000
51 200000
16 200000
10 200000
16 200000
43 200000
12 200000
35 200000
6 200000
77 200000
40 200000
66 200000
30 200000
18 200000
36 200000
12 200000
26 200000
37 200000
39 200000
11 200000
69 200000
57 200000
15 200000
8 200000
19 200000
32 200000
35 200000...

output:

131384
192629
61130
80247
87887
198740
163105
103211
176599
77117
195385
125105
27678
146598
146076
171154
143664
106375
184677
176668
63515
47861
66512
94607
61773
118863
110829
90228
162033
193193
118985
114311
63857
156350
94535
157429
67223
146494
96304
188983
139817
196687
121473
115649
160519
...

result:

ok 200000 numbers

Test #20:

score: 0
Accepted
time: 141ms
memory: 21916kb

input:

200000 200000
6 200000
3 200000
6 200000
7 200000
2 200000
9 200000
4 200000
3 200000
0 200000
6 200000
3 200000
3 200000
1 200000
8 200000
4 200000
3 200000
5 200000
2 200000
2 200000
2 200000
4 200000
5 200000
6 200000
3 200000
7 200000
1 200000
2 200000
7 200000
2 200000
1 200000
6 200000
1 20000...

output:

191039
169762
165539
174400
68195
177129
154654
147432
156994
76044
194413
99752
191624
151075
197252
164294
18272
88957
158459
84713
87887
43439
179674
131694
123135
59410
106882
159392
139714
64645
69698
100948
140917
103251
45494
170482
166885
104101
194216
145914
120315
76168
77653
141867
198409...

result:

ok 200000 numbers

Test #21:

score: 0
Accepted
time: 99ms
memory: 22164kb

input:

200000 200000
17611 69131
59430 76978
15340 23731
45422 61357
24684 32905
12111 30945
3173 53122
1908 18775
21868 25563
43076 69772
23316 73134
37315 71711
16622 29769
5311 27384
7573 9838
45306 81042
21408 85530
32497 55253
12816 72989
13973 55180
2256 48643
39562 81719
47954 61844
8166 64533
5302 ...

output:

1
2
6
0
2
0
0
0
3
7
1
2
0
0
2
10
1
0
0
1
13
0
2
2
0
4
0
1
7
0
4
14
1
1
0
2
0
0
0
0
5
0
14
4
0
2
14
0
2
0
0
2
1
0
2
1
0
8
10
0
0
8
3
0
10
4
1
1
0
0
13
3
0
4
0
1
1
2
0
1
8
4
1
0
0
5
2
8
0
0
0
1
1
0
0
0
4
9
9
7
2
0
2
13
3
0
0
2
0
0
0
1
0
5
10
5
13
1
0
7
10
1
2
3
0
0
1
5
1
5
0
0
1
0
1
0
1
0
1
7
4
1
0
3
...

result:

ok 200000 numbers

Subtask #3:

score: 15
Accepted

Test #22:

score: 15
Accepted
time: 176ms
memory: 21908kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 0
0 9
0 10
0 0
0 0
0 13
0 14
0 0
0 16
0 17
0 18
0 19
0 0
0 21
0 22
0 23
0 0
0 0
0 0
0 0
0 28
0 0
0 30
0 31
0 32
0 33
0 34
0 35
0 0
0 0
0 38
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 0
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 57
0 0
0 59
0 60
0 0
0 0
...

output:

19141
39288
14841
58655
15427
4999
26338
93250
2826
78084
64070
55481
2565
15173
24866
57627
35887
51335
67552
44939
27730
24781
54502
26903
73199
7553
3836
41740
67889
104576
43522
3766
13007
31659
17264
85349
16595
28681
64012
56457
23856
47820
22752
86123
37679
44828
88810
36305
15843
33728
10005...

result:

ok 200000 numbers

Test #23:

score: 0
Accepted
time: 162ms
memory: 22040kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 0
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 0
0 27
0 28
0 29
0 30
0 0
0 32
0 33
0 34
0 35
0 36
0 0
0 0
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 47
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 0
0 58
0 59
0 60
0...

output:

168949
95410
33682
47935
82249
25613
65578
22342
60917
30684
99457
21252
87719
9508
41909
17405
96346
6219
110867
56725
71026
2090
45186
37640
26229
36720
91410
64919
7095
29903
44679
40307
100104
41603
87434
53924
53758
80720
59404
164539
38810
117092
13565
110110
38606
32273
93240
81294
10356
1504...

result:

ok 200000 numbers

Test #24:

score: 0
Accepted
time: 160ms
memory: 22048kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 12
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 26
0 27
0 28
0 29
0 30
0 31
0 32
0 33
0 34
0 35
0 36
0 37
0 38
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 47
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 57
0 58
0 59
...

output:

69217
146306
97579
32894
129999
10418
98425
25273
33368
29464
14306
2073
112582
140228
24801
40781
52137
17338
110491
48418
54730
20451
84100
80588
2089
108163
29975
56448
14978
35560
102453
18613
30516
18699
83182
28795
25862
126187
116576
99593
36207
13935
27150
75205
66741
91089
151786
19917
2529...

result:

ok 200000 numbers

Test #25:

score: 0
Accepted
time: 175ms
memory: 21896kb

input:

200000 200000
0 5
0 99
0 23
0 88
0 62
0 24
0 80
0 70
0 45
0 55
0 99
0 91
0 82
0 99
0 47
0 80
0 9
0 4
0 51
0 64
0 52
0 2
0 2
0 81
0 98
0 36
0 27
0 34
0 97
0 22
0 89
0 77
0 89
0 25
0 90
0 91
0 77
0 37
0 89
0 52
0 58
0 18
0 81
0 35
0 56
0 71
0 18
0 56
0 74
0 40
0 76
0 47
0 87
0 11
0 81
0 48
0 59
0 17
0...

output:

101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
...

result:

ok 200000 numbers

Test #26:

score: 0
Accepted
time: 183ms
memory: 21916kb

input:

200000 200000
0 193
0 229
0 553
0 197
0 718
0 370
0 853
0 695
0 764
0 571
0 714
0 700
0 692
0 293
0 962
0 536
0 482
0 148
0 804
0 864
0 925
0 864
0 296
0 757
0 283
0 338
0 746
0 447
0 365
0 390
0 689
0 239
0 60
0 388
0 822
0 836
0 373
0 703
0 107
0 894
0 468
0 125
0 851
0 568
0 914
0 391
0 759
0 66
...

output:

1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
986
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
834
1001
999
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
995
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001...

result:

ok 200000 numbers

Test #27:

score: 0
Accepted
time: 203ms
memory: 21864kb

input:

200000 200000
0 7698
0 6154
0 6707
0 7442
0 9621
0 8045
0 8938
0 5518
0 4134
0 3188
0 8054
0 5380
0 2409
0 3360
0 2771
0 9642
0 8264
0 4305
0 2844
0 7810
0 4706
0 1462
0 6282
0 2481
0 2987
0 3633
0 2634
0 4866
0 5079
0 2325
0 4394
0 8361
0 322
0 2614
0 7668
0 9067
0 452
0 2834
0 3340
0 2193
0 4070
0...

output:

9992
10001
10001
10000
10001
10001
9910
9932
2155
6995
10001
9347
10001
10001
10000
8952
9997
10000
9996
9999
10001
9996
10001
10000
9949
8842
9944
10000
10000
6517
9719
7997
10001
9875
10000
10001
10001
10001
10001
7481
10001
564
9962
8180
10001
7708
9902
9995
6677
10000
10000
9993
9841
6942
9584
1...

result:

ok 200000 numbers

Test #28:

score: 0
Accepted
time: 200ms
memory: 21928kb

input:

200000 200000
0 44932
0 12196
0 776
0 35673
0 44618
0 16521
0 9747
0 42216
0 21955
0 3389
0 22
0 15248
0 5734
0 45217
0 47977
0 8869
0 25942
0 3415
0 40771
0 28517
0 29726
0 13420
0 30474
0 44930
0 10541
0 4648
0 26903
0 19507
0 2998
0 24757
0 10645
0 47790
0 25779
0 41892
0 37322
0 34913
0 36562
0 ...

output:

48090
32992
22437
48207
21332
45359
39653
11005
43989
17371
8176
34898
30342
43305
36171
34310
36953
26580
26406
40517
30042
24009
21601
48636
34590
44645
6569
1680
36941
44685
8184
29538
47471
13134
37634
44021
16542
45480
34004
2798
44629
42393
43534
32749
42758
39005
46942
906
35042
32188
39406
4...

result:

ok 200000 numbers

Test #29:

score: 0
Accepted
time: 190ms
memory: 22020kb

input:

200000 200000
0 17611
0 59430
0 23731
0 61357
0 32905
0 30945
0 53122
0 18775
0 25563
0 43076
0 23316
0 71711
0 16622
0 27384
0 9838
0 81042
0 85530
0 32497
0 12816
0 55180
0 2256
0 81719
0 61844
0 64533
0 5302
0 33711
0 18419
0 98385
0 48813
0 58297
0 63392
0 29066
0 12542
0 14198
0 27695
0 23110
0...

output:

20413
33643
27062
9573
23562
70288
46728
62984
61505
69707
52256
43819
42924
84768
46751
32254
29961
25002
61760
47063
54538
23381
4229
40146
56797
35682
73141
55198
81237
4145
14779
79432
46593
8554
55961
48948
59145
73439
77423
43568
51349
68840
23328
1413
10825
33789
61183
12488
53414
60374
77583...

result:

ok 200000 numbers

Test #30:

score: 0
Accepted
time: 174ms
memory: 21904kb

input:

200000 200000
0 19
0 50
0 16
0 8
0 27
0 35
0 43
0 42
0 8
0 45
0 39
0 16
0 23
0 29
0 10
0 10
0 50
0 23
0 50
0 45
0 16
0 17
0 30
0 17
0 35
0 50
0 2
0 15
0 33
0 41
0 38
0 12
0 2
0 5
0 37
0 11
0 26
0 35
0 25
0 12
0 38
0 28
0 5
0 46
0 46
0 39
0 26
0 36
0 22
0 9
0 1
0 45
0 36
0 6
0 15
0 31
0 2
0 3
0 0
0 4...

output:

51
51
51
51
51
51
51
51
51
27
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
51
...

result:

ok 200000 numbers

Test #31:

score: 0
Accepted
time: 166ms
memory: 21896kb

input:

200000 200000
0 3
0 3
0 10
0 1
0 7
0 6
0 6
0 4
0 8
0 0
0 5
0 4
0 8
0 7
0 5
0 0
0 1
0 9
0 1
0 1
0 3
0 7
0 10
0 9
0 4
0 6
0 6
0 1
0 5
0 7
0 8
0 1
0 0
0 8
0 9
0 7
0 8
0 7
0 2
0 8
0 6
0 6
0 5
0 7
0 2
0 0
0 6
0 7
0 5
0 3
0 3
0 10
0 3
0 0
0 3
0 3
0 9
0 0
0 7
0 2
0 10
0 10
0 10
0 3
0 2
0 5
0 9
0 1
0 1
0 9
...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 200000 numbers

Subtask #4:

score: 0
Wrong Answer

Test #32:

score: 0
Wrong Answer
time: 155ms
memory: 21924kb

input:

200000 200000
0 200000
1 200000
1 200000
0 200000
0 200000
1 200000
1 200000
1 200000
0 200000
1 200000
0 200000
0 200000
1 200000
0 200000
0 200000
0 200000
0 200000
1 200000
0 200000
0 200000
1 200000
0 200000
1 200000
1 200000
1 200000
1 200000
0 200000
0 200000
1 200000
2 200000
1 200000
2 20000...

output:

71224
21392
65745
35080
62292
29292
146310
136621
165312
81582
25124
120262
104925
12518
90915
0
50072
0
0
106446
92329
71506
16694
4846
38213
34902
133281
98867
697
13778
6636
173460
61316
71682
15563
112192
125788
15305
27739
0
18655
0
10898
115176
15545
29080
101777
120170
126409
47301
69896
7603...

result:

wrong answer 3rd numbers differ - expected: '65746', found: '65745'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%