用户输出
2 3
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#49109 | #1264. 视频质量 | Accepted | 100 | 10412 ms | 41172 K | C++ 17 / 1.6 K | wahahah | 2021-05-21 18:43:36 |
#include <bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-20
#define fi first
#define se second
using namespace std;
using cd = complex<double>;
typedef long long ll;
typedef long double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;
ll n, m, tree[800056];
struct ppp {
ll l, r, p;
} a[200005];
bool cmp(ppp i, ppp j) {
if (i.l == j.l)
return i.r > j.r;
return i.l < j.l;
}
ll cal() {
sort(a + 1, a + 1 + n, cmp);
ll mxr = a[1].r, nowr = a[1].r, now = 0, num = 1;
for (ll i = 2; i <= n; i++) {
while (i <= n && a[i].l <= nowr + 1) {
if (a[i].r > mxr) {
mxr = a[i].r;
now = i;
}
i++;
}
if (now == 0)
break;
num++;
nowr = mxr;
i--;
now = 0;
}
return num;
}
void add(ll x, ll v) {
while (x <= 800005) {
tree[x] += v;
x += x & (-x);
}
}
ll query(ll x) {
ll res = 0;
while (x) {
res += tree[x];
x -= x & (-x);
}
return res;
}
int main() {
cin >> n >> m;
set<ll> s;
vector<ll> p;
for (ll i = 1; i <= n; i++) {
scanf("%lld%lld", &a[i].l, &a[i].r);
a[i].r--;
s.insert(a[i].l);
s.insert(a[i].r);
s.insert(a[i].r + 1);
s.insert(a[i].l - 1);
}
ll ans1 = cal(), ans = 0;
p.push_back(-2e18);
for (auto i : s) {
p.push_back(i);
}
for (ll i = 1; i <= n; i++) {
ll v = lower_bound(p.begin(), p.end(), a[i].l) - p.begin();
ll h = lower_bound(p.begin(), p.end(), a[i].r + 1) - p.begin();
add(v, 1);
add(h, -1);
}
for (ll i = 1; i < p.size(); i++) {
if (p[i] >= m || p[i] < 0)
continue;
ll v = query(i);
ans = max(ans, n - v + 1);
}
cout << ans1 << " " << ans << endl;
}
72 6951
1279 5415
5774 5967
352 2975
4106 6269
565 3393
4119 5218
3154 4517
1323 4249
5468 6430
4356
<613 bytes omitted>
用户输出
3 72
系统信息
Exited with return code 0
25 6007
2636 5976
4846 4848
2011 2320
4483 5650
4590 5525
5686 5983
4438 6007
3487 5407
5611 6005
59
<153 bytes omitted>
用户输出
2 25
系统信息
Exited with return code 0
71 5875
3245 4539
2453 2646
5139 5424
4735 5233
0 5852
1073 1109
3220 4838
482 1667
4111 5874
1738 5
<602 bytes omitted>
用户输出
2 71
系统信息
Exited with return code 0
72 3554
2007 2891
2321 3403
3423 3452
3513 3545
2651 2798
629 3542
3150 3310
2827 3181
550 3554
2884
<599 bytes omitted>
用户输出
2 72
系统信息
Exited with return code 0
12 2462
1212 2458
392 1970
710 1769
533 1677
1694 1742
2026 2462
0 1381
48 1400
1042 2460
1912 2330
<17 bytes omitted>
用户输出
3 12
系统信息
Exited with return code 0
11 8900
6913 8898
4203 8886
0 8147
5469 8883
7658 8900
8154 8876
3532 8701
4251 8869
7214 8843
8626
<15 bytes omitted>
用户输出
2 11
系统信息
Exited with return code 0
54 8641
6433 7171
5844 5934
5405 7192
6544 6631
3012 5527
5374 6052
3439 6694
4120 4686
7324 8329
44
<434 bytes omitted>
用户输出
3 54
系统信息
Exited with return code 0
31 7482
1130 7210
4939 6328
0 66
28 89
1772 6450
3255 6386
1363 7482
5576 5931
1608 5509
4072 4513
1
<204 bytes omitted>
用户输出
4 31
系统信息
Exited with return code 0
28 4245
2269 4219
2856 4233
2548 4205
2111 4243
741 2578
1329 4072
683 1698
1891 4196
1483 2331
3900
<172 bytes omitted>
用户输出
3 28
系统信息
Exited with return code 0
19 7893
7205 7860
1081 4787
362 7778
3599 7892
7729 7730
5390 7773
2426 6594
2533 7893
2215 3878
649
<94 bytes omitted>
用户输出
2 19
系统信息
Exited with return code 0
114343 999999779541
961721540565 976396960953
589941177726 866813045481
621153122593 897177242310
90
<2959528 bytes omitted>
用户输出
3 114343
系统信息
Exited with return code 0
114696 999999248497
304084248466 394866293909
662209401853 826810816600
468842921373 883848636199
81
<2968509 bytes omitted>
用户输出
3 114696
系统信息
Exited with return code 0
177836 999999870469
23534665826 489867815775
150000080390 988176630989
503276260048 829600836873
342
<4603184 bytes omitted>
用户输出
3 177836
系统信息
Exited with return code 0
116188 999999161844
257334261947 292880632549
948789768188 999216207608
109948920728 746143652324
96
<3007161 bytes omitted>
用户输出
3 116188
系统信息
Exited with return code 0
178705 999999614604
636586866727 705987923669
401913764451 660567007809
813783020379 861099118576
41
<4625434 bytes omitted>
用户输出
3 178705
系统信息
Exited with return code 0
182323 999999477491
180321575960 222599363339
802117625127 823622213305
753679082691 774286562443
28
<4719123 bytes omitted>
用户输出
3 182323
系统信息
Exited with return code 0
180898 999999014815
334450228466 503334784963
186830709333 693681893088
449404226182 784311456420
89
<4682189 bytes omitted>
用户输出
2 180898
系统信息
Exited with return code 0
115971 999999514122
332911922913 398852633639
731886467352 805950656635
59059337874 704335692355
389
<3001506 bytes omitted>
用户输出
2 115971
系统信息
Exited with return code 0
192768 999999439479
498230628051 744382496510
304239236926 372870323833
18007344976 124743197690
546
<4989193 bytes omitted>
用户输出
3 192768
系统信息
Exited with return code 0
108443 999999341365
53221339435 115446156985
300672764130 911228668020
531978250460 951983524623
829
<2806983 bytes omitted>
用户输出
3 108443
系统信息
Exited with return code 0
123433 999999525048
126556719391 126565129743
586559992553 586560132976
158776656302 158777039337
47
<3181669 bytes omitted>
用户输出
123433 123433
系统信息
Exited with return code 0
133322 999999942139
44035860514 44050764417
646721153264 646728497889
135210336630 135246229851
3883
<3436563 bytes omitted>
用户输出
133322 133322
系统信息
Exited with return code 0
184849 999999351144
431984304061 431984660839
250205459053 250205995164
964701611400 964711353284
38
<4765239 bytes omitted>
用户输出
184849 184849
系统信息
Exited with return code 0
133305 999999150833
277808551083 277808858774
548031618768 548037194721
339904394375 339906740225
20
<3436225 bytes omitted>
用户输出
133305 133305
系统信息
Exited with return code 0
125262 999999739261
527111546180 527140713840
446544124871 446545528054
37279102188 37281436408
1739
<3229099 bytes omitted>
用户输出
125262 125262
系统信息
Exited with return code 0
117036 999999207073
924898681342 924907280420
495168851503 495178535102
513244564026 513248946276
38
<3016721 bytes omitted>
用户输出
117036 117036
系统信息
Exited with return code 0
122772 999999619576
225695262376 225695383570
61720072372 61744130552
545469982599 545478997918
2194
<3164659 bytes omitted>
用户输出
122772 122772
系统信息
Exited with return code 0
176214 999999223579
158281525277 158283764698
336300196500 336314598715
158492961550 158514222617
93
<4541891 bytes omitted>
用户输出
176214 176214
系统信息
Exited with return code 0
154454 999999726350
775213251453 775215208424
98845129269 98855562609
918315624821 918319316286
4897
<3981363 bytes omitted>
用户输出
154454 154454
系统信息
Exited with return code 0
115078 999999245315
726164925974 726165360110
474649463740 474655039338
990086412665 990090397531
55
<2966327 bytes omitted>
用户输出
115078 115078
系统信息
Exited with return code 0
78 2234
843 1954
1253 2232
76 1630
1959 2182
846 1516
1593 2179
299 625
584 2212
1737 2234
0 1623
12
<612 bytes omitted>
用户输出
2 70
系统信息
Exited with return code 0
30 5236
102 4343
2803 4386
344 5236
2580 3155
1545 4398
341 4397
630 5227
109 2790
883 5202
3093 522
<185 bytes omitted>
用户输出
2 28
系统信息
Exited with return code 0
48 661
458 661
13 330
84 370
0 364
376 661
531 658
414 650
0 214
0 93
149 659
394 661
567 656
294 43
<260 bytes omitted>
用户输出
2 42
系统信息
Exited with return code 0
59 2799
0 1846
1340 2799
842 2796
1975 2575
0 210
1021 2140
1110 2743
1324 2733
1941 2777
1481 2752
<441 bytes omitted>
用户输出
2 52
系统信息
Exited with return code 0
82 9770
0 8852
1138 9770
187 9759
44 9281
3526 9770
7695 9763
1504 9424
5233 9664
6228 9742
6942 973
<689 bytes omitted>
用户输出
2 75
系统信息
Exited with return code 0
180887 999999512581
825645680629 999999512444
536478255934 999998616065
409631587128 999999512500
71
<4609546 bytes omitted>
用户输出
2 174480
系统信息
Exited with return code 0
166215 999999083910
932277721669 999998808152
820286890342 999877234734
797971830723 999999083200
80
<4235947 bytes omitted>
用户输出
2 160330
系统信息
Exited with return code 0
140033 999999964495
884152331309 999953407316
689367125269 999999964489
885750454891 999999964462
93
<3568396 bytes omitted>
用户输出
2 135058
系统信息
Exited with return code 0
168314 999999877582
339184905364 999897694096
822226436710 998667736142
578878409980 999989795547
41
<4289489 bytes omitted>
用户输出
2 162357
系统信息
Exited with return code 0
193662 999999481410
48176056775 984631639081
625530390709 994363764795
649863398127 999994504395
244
<4935306 bytes omitted>
用户输出
2 186799
系统信息
Exited with return code 0
142981 689077158414
577043733416 689077158414
318699618556 689077158414
151791726189 689077158414
30
<3694324 bytes omitted>
用户输出
1 142981
系统信息
Exited with return code 0
123181 855545768529
0 527287811109
0 692513251203
0 276864636907
0 551241902836
0 80778003487
0 1869
<1831651 bytes omitted>
用户输出
1 123181
系统信息
Exited with return code 0
95109 782835636526
279886019094 782835636526
638701338023 782835636526
240321214781 782835636526
249
<2459377 bytes omitted>
用户输出
1 95109
系统信息
Exited with return code 0
73793 164940686270
0 17433432279
0 89114952185
0 109134500769
0 108976903952
0 16862518764
0 7649129
<1057191 bytes omitted>
用户输出
1 73793
系统信息
Exited with return code 0
138153 956139304493
35612602936 956139304493
390290432506 956139304493
360592236152 956139304493
430
<3575981 bytes omitted>
用户输出
1 138153
系统信息
Exited with return code 0
934 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0 482
0
<5512 bytes omitted>
用户输出
1 1
系统信息
Exited with return code 0
78571 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
0 317
<471336 bytes omitted>
用户输出
1 1
系统信息
Exited with return code 0
107346 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
0 105
<643987 bytes omitted>
用户输出
1 1
系统信息
Exited with return code 0
69341 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
0 726
<415956 bytes omitted>
用户输出
1 1
系统信息
Exited with return code 0
120692 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
0 908
<724063 bytes omitted>
用户输出
1 1
系统信息
Exited with return code 0
92600 899738889826
426830588005 473110965778
365999817027 534127316024
410474267648 489470515171
591
<2384838 bytes omitted>
用户输出
1 92600
系统信息
Exited with return code 0
65905 436519933599
151682561703 283535393643
58634773523 377354755874
195753578096 240373114651
1795
<1679918 bytes omitted>
用户输出
1 65905
系统信息
Exited with return code 0
27371 901564415809
395242895567 504800752585
421880623258 478576331220
397788884944 502394724594
430
<704734 bytes omitted>
用户输出
1 27371
系统信息
Exited with return code 0
126382 309000231199
144775794453 164326994294
42056972833 266857786893
129676651101 179368155301
554
<3195022 bytes omitted>
用户输出
1 126382
系统信息
Exited with return code 0
8942 479958479104
98601802543 381637678203
105778049588 373896264513
1970556489 478602109024
1538085
<228277 bytes omitted>
用户输出
1 8942
系统信息
Exited with return code 0
168127 927698122514
276204290488 848399366020
0 927698122514
0 927698122514
0 927698122514
324389326
<3428373 bytes omitted>
用户输出
1 84245
系统信息
Exited with return code 0
107354 788589901002
122608333072 572467631268
451678878510 779308952217
59835229888 656193842335
350
<2185928 bytes omitted>
用户输出
1 53731
系统信息
Exited with return code 0
161806 687049433344
0 687049433344
0 687049433344
0 687049433344
0 687049433344
534185555586 6180807
<3292733 bytes omitted>
用户输出
1 81089
系统信息
Exited with return code 0
77615 442085433825
0 442085433825
0 442085433825
0 442085433825
37279692054 262754112332
16438754026
<1568211 bytes omitted>
用户输出
1 38497
系统信息
Exited with return code 0
50781 174321114411
14765003367 156061137659
0 174321114411
0 174321114411
0 174321114411
0 174321114
<1008653 bytes omitted>
用户输出
1 25392
系统信息
Exited with return code 0