QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#836390#3679. 楼房重建wkh200860 918ms29496kbC++141.5kb2024-12-28 19:29:012024-12-28 19:29:02

Judging History

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

  • [2024-12-28 19:29:02]
  • 评测
  • 测评结果:60
  • 用时:918ms
  • 内存:29496kb
  • [2024-12-28 19:29:01]
  • 提交

answer

#include <bits/stdc++.h>
#define F_(i, a, b) for (int i = (a); i <= (b); i++)
#define _F(i, a, b) for (int i = (a); i >= (b); i--)
#define vc vector
#define bg begin
#define ed end
#define rbg rbegin
#define red rend
#define pb push_back
#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define pe prev
#define nx next
#define sz size
#define bk back
#define pp pop_back
#define in insert
#define es erase
#define fd find
#define ct count
#define lb lower_bound
#define ub upper_bound
#define IL inline
#define mkp make_pair
#define acc accumulate
#define exg exchange
#define inp inplace_merge
using namespace std;
using ll = long long;
using unt = unsigned;
using pi = pair<int, int>;

template <typename T>
IL void ckm(T &a, const T &b) { (b < a) && (a = b); }
template <typename T>
IL void ckx(T &a, const T &b) { (b > a) && (a = b); }

const int N = 1e5 + 5;
basic_string<double> t[N * 4];
#define ls(x) (x * 2)
#define rs(x) (x * 2 + 1)
int n, m;
IL void U(int o) {
  t[o] = t[ls(o)] + t[rs(o)].substr(ub(t[rs(o)].bg(), t[rs(o)].ed(), t[ls(o)].bk()) - t[rs(o)].bg());
}
void C(int x, int y, int o = 1, int L = 1, int R = n) {
  if (L == R)
    return t[o].resize(1), t[o].bk() = 1. * y / x, void();
  int M = (L + R) / 2;
  x <= M ? C(x, y, ls(o), L, M) : C(x, y, rs(o), M + 1, R);
  U(o);
}

signed main() {
  cin.tie(0) -> sync_with_stdio(false);
  cin >> n >> m;
  for (int tim = 1, x, y; tim <= m; tim++) {
    cin >> x >> y, C(x, y);
    cout << t[1].sz() << '\n';
  }
  return 0;
}

详细


Pretests


Final Tests

Test #1:

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

input:

10 100
6 166267291
4 764085103
1 12360641
1 846991393
6 383204345
2 69698641
9 12331341
1 772764651
5 131311041
10 46049537
6 690746401
2 145679903
10 758217
4 201987721
9 249525949
7 161049529
6 110578175
4 231517001
5 644489651
7 340648201
7 151799407
10 7480386
3 206257865
9 328935144
3 352739143...

output:

1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 100 lines

Test #2:

score: 10
Accepted
time: 6ms
memory: 16136kb

input:

5000 5000
4055 116561953
2381 100240024
2004 417074916
1427 997789281
3389 362989109
3151 584964927
1010 338776377
4005 652116037
679 787404691
1707 456436289
3237 116187877
763 591467095
4591 992346901
4771 675683041
3214 220111386
2959 491101999
1756 29122121
3931 269053489
1024 539141721
1298 362...

output:

1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 5000 lines

Test #3:

score: 10
Accepted
time: 45ms
memory: 17104kb

input:

50000 50000
11197 523959184
21870 174130291
8961 383622388
5855 17591001
2034 116080369
2999 48813129
13681 400639393
26120 545371291
10812 615573145
3846 224445841
23741 3512321
27980 425609076
20600 67673449
19022 21208449
7613 179168546
22248 582006973
3195 559122129
30805 882930960
2357 12836663...

output:

1
1
2
3
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 50000 lines

Test #4:

score: 10
Accepted
time: 100ms
memory: 17188kb

input:

100000 100000
20078 506888119
12662 18121087
9727 14838729
6119 4331773
4115 148763931
15246 155262241
16638 933023110
2671 278021329
7591 419392075
27852 148148071
9023 601987189
20034 325680001
15306 39381877
22314 907072316
22375 25876929
12920 1871849
12400 507255871
15242 403346861
13493 336991...

output:

1
2
2
3
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
1
1
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100000 lines

Test #5:

score: 10
Accepted
time: 291ms
memory: 22624kb

input:

30000 30000
17319 15171443
25912 22698911
25733 22542107
18739 16415363
27670 24238919
15814 13853063
21762 19063511
28952 25361951
23861 20902235
23595 20669219
28799 25227923
24340 21321839
22710 19893959
22369 19595243
18955 16604579
29636 25961135
19807 17350931
26598 23299847
27967 24499091
195...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 30000 lines

Test #6:

score: 10
Accepted
time: 918ms
memory: 29496kb

input:

50000 50000
49898 43710647
48279 42292403
27063 23707187
39809 34872683
40038 35073287
28476 24944975
45856 40169855
27643 24215267
31608 27688607
35509 31105883
49654 43496903
43563 38161187
49463 43329587
47666 41755415
42309 37062683
42435 37173059
44870 39306119
27322 23934071
42841 37528715
384...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 50000 lines

Test #7:

score: 0
Time Limit Exceeded

input:

70000 70000
66320 65457839
69425 68522474
60370 59585189
65008 64162895
62987 62168168
45238 44649905
43693 43124990
69269 68368502
61265 60468554
44163 43588880
35096 34639751
54253 53547710
65657 64803458
66359 65496332
68429 67539422
45704 45109847
49336 48694631
37814 37322417
61266 60469541
530...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:


Test #8:

score: 0
Time Limit Exceeded

input:

80000 80000
75926 749845175
54296 536227295
70792 699141791
67587 667489211
68827 679735451
64067 632725691
76742 757903991
79231 782485355
77910 769439159
58999 582674123
66049 652299923
69783 689176907
70343 694707467
71891 709995515
70699 698223323
70767 698894891
66086 652665335
69294 684347543
...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:


Test #9:

score: 0
Time Limit Exceeded

input:

90000 90000
57366 566546615
55176 544918175
62991 622099115
53284 526232783
78371 773991995
52628 519754127
89881 887664755
59895 591523019
51313 506767187
68146 673009895
74890 739613639
78727 777507851
66677 658502051
86236 851666735
70198 693275447
76456 755079455
45865 452962739
62514 617388263
...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:


Test #10:

score: 0
Time Limit Exceeded

input:

100000 100000
82774 817476023
92562 914142311
55100 544167599
77673 767098547
84937 838837811
97569 963591443
87753 866648627
88967 878638091
85842 847775591
92889 917371763
53689 530232563
75333 743988707
82569 815451443
64934 641288183
63573 627846947
81009 800044883
98230 970119479
81765 80751113...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result: