QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#329498 | #3290. Starting a Scenic Railroad Service | chmpro | WA | 43ms | 8944kb | C++20 | 1.4kb | 2024-02-16 19:51:02 | 2024-02-16 19:51:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
typedef pair<int, int> p;
#define rep(i, st, ed) for(int i = st; i < ed; ++i)
#ifndef ONLINE_JUDGE
#include "myprettyprint.hpp"
#else
#define dbg(...)
#endif
const int SZ=100010;
struct segtree{
vl TREE;
int N;
void init(int n){
N=n;
TREE.resize(N*2);
}
void update(int p){
p+=N;
TREE[p]+=1;
while(p>1){
p>>=1;
TREE[p]=TREE[p<<1]+TREE[p<<1|1];
}
}
int16_t qry(int l,int r){
l+=N, r+=N;
int ret=0;
while(l<=r){
if (l%2==1) ret+=TREE[l];
if (r%2==0) ret+=TREE[r];
l=(l+1)>>1;
r=(r-1)>>1;
}
return ret;
}
}T1,T2;
int N;
vector<p> A;
void solve(){
cin>>N;
A.resize(N); T1.init(SZ); T2.init(SZ);
rep(i,0,N) {
int a,b;cin>>a>>b;
A[i]={a,b-1};
}
sort(A.begin(),A.end());
priority_queue<int> HQ;
int ans1=0,cnt=0;
for(auto [a,b]:A){
T1.update(a); T2.update(b);
while(!HQ.empty() && HQ.top()>-a){
cnt--;
HQ.pop();
}
cnt++;
HQ.push(-b);
ans1=max(ans1,cnt);
}
int ans2=0;
for(auto [a,b]:A){
ans2=max(ans2,T1.qry(0,b)-T2.qry(0,a-1));
}
cout << ans2 << ' ' << ans1 << '\n';
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 6232kb
input:
1 1 100000
output:
1 1
result:
ok single line: '1 1'
Test #2:
score: 0
Accepted
time: 43ms
memory: 7792kb
input:
200000 538 540 37 39 708 710 540 541 583 585 224 226 866 868 914 916 405 406 185 187 542 545 335 336 217 220 546 548 952 954 414 415 799 800 826 827 844 846 207 209 967 968 632 635 517 519 581 584 63 64 309 311 146 149 493 494 526 529 589 591 32 33 6 7 486 489 372 373 233 236 278 279 524 525 554 555...
output:
917 467
result:
ok single line: '917 467'
Test #3:
score: 0
Accepted
time: 0ms
memory: 6212kb
input:
1000 89384 89472 92778 92795 47794 47831 85387 85481 16650 16673 2363 2392 68691 68752 97764 97792 80541 80569 89173 89211 5212 5282 2568 2599 65783 65815 22863 22888 74068 74105 13930 13934 34023 34083 33070 33139 61394 61452 75012 75056 76230 76305 84422 84443 13785 13824 75199 75225 98316 98388 6...
output:
6 4
result:
ok single line: '6 4'
Test #4:
score: 0
Accepted
time: 2ms
memory: 6312kb
input:
1000 89384 89472 92778 92895 47794 47931 85387 85481 16650 16673 2363 2392 68691 68752 97764 97892 80541 80569 89173 89311 5212 5382 2568 2599 65783 65915 22863 22988 74068 74205 13930 13934 34023 34083 33070 33239 61394 61452 75012 75056 76230 76405 84422 84543 13785 13924 75199 75325 98316 98488 6...
output:
10 7
result:
ok single line: '10 7'
Test #5:
score: 0
Accepted
time: 0ms
memory: 6264kb
input:
1000 89384 89672 92778 92895 47794 48031 85387 85581 16650 16773 2363 2492 68691 68952 97764 97992 80541 80669 89173 89311 5212 5282 2568 2699 65783 66015 22863 23088 74068 74305 13930 14034 34023 34283 33070 33339 61394 61652 75012 75156 76230 76505 84422 84543 13785 13824 75199 75425 98316 98588 6...
output:
11 7
result:
ok single line: '11 7'
Test #6:
score: 0
Accepted
time: 2ms
memory: 6204kb
input:
1000 89384 89472 92778 92895 47794 48131 85387 85481 16650 16873 2363 2392 68691 68752 97764 98092 80541 80769 89173 89311 5212 5382 2568 2599 65783 66115 22863 23188 74068 74405 13930 14134 34023 34283 33070 33239 61394 61452 75012 75056 76230 76405 84422 84543 13785 13924 75199 75525 98316 98688 6...
output:
13 9
result:
ok single line: '13 9'
Test #7:
score: 0
Accepted
time: 2ms
memory: 6212kb
input:
1000 89384 89772 92778 93195 47794 48131 85387 85881 16650 17073 2363 2392 68691 68752 97764 98192 80541 80969 89173 89411 5212 5582 2568 2999 65783 65815 22863 22988 74068 74205 13930 14234 34023 34083 33070 33239 61394 61852 75012 75056 76230 76605 84422 84843 13785 13824 75199 75525 98316 98688 6...
output:
15 9
result:
ok single line: '15 9'
Test #8:
score: 0
Accepted
time: 8ms
memory: 6476kb
input:
20000 89384 89472 92778 92795 47794 47831 85387 85481 16650 16673 2363 2392 68691 68752 97764 97792 80541 80569 89173 89211 5212 5282 2568 2599 65783 65815 22863 22888 74068 74105 13930 13934 34023 34083 33070 33139 61394 61452 75012 75056 76230 76305 84422 84443 13785 13824 75199 75225 98316 98388 ...
output:
50 26
result:
ok single line: '50 26'
Test #9:
score: 0
Accepted
time: 8ms
memory: 6584kb
input:
20000 89384 89472 92778 92895 47794 47931 85387 85481 16650 16673 2363 2392 68691 68752 97764 97892 80541 80569 89173 89311 5212 5382 2568 2599 65783 65915 22863 22988 74068 74205 13930 13934 34023 34083 33070 33239 61394 61452 75012 75056 76230 76405 84422 84543 13785 13924 75199 75325 98316 98488 ...
output:
86 39
result:
ok single line: '86 39'
Test #10:
score: 0
Accepted
time: 8ms
memory: 6584kb
input:
20000 89384 89672 92778 92895 47794 48031 85387 85581 16650 16773 2363 2492 68691 68952 97764 97992 80541 80669 89173 89311 5212 5282 2568 2699 65783 66015 22863 23088 74068 74305 13930 14034 34023 34283 33070 33339 61394 61652 75012 75156 76230 76505 84422 84543 13785 13824 75199 75425 98316 98588 ...
output:
116 51
result:
ok single line: '116 51'
Test #11:
score: 0
Accepted
time: 8ms
memory: 6472kb
input:
20000 89384 89472 92778 92895 47794 48131 85387 85481 16650 16873 2363 2392 68691 68752 97764 98092 80541 80769 89173 89311 5212 5382 2568 2599 65783 66115 22863 23188 74068 74405 13930 14134 34023 34283 33070 33239 61394 61452 75012 75056 76230 76405 84422 84543 13785 13924 75199 75525 98316 98688 ...
output:
150 67
result:
ok single line: '150 67'
Test #12:
score: 0
Accepted
time: 1ms
memory: 6204kb
input:
5 1 100000 1 100000 1 100000 1 100000 1 100000
output:
5 5
result:
ok single line: '5 5'
Test #13:
score: 0
Accepted
time: 8ms
memory: 6416kb
input:
20000 89384 89772 92778 93195 47794 48131 85387 85881 16650 17073 2363 2392 68691 68752 97764 98192 80541 80969 89173 89411 5212 5582 2568 2999 65783 65815 22863 22988 74068 74205 13930 14234 34023 34083 33070 33239 61394 61852 75012 75056 76230 76605 84422 84843 13785 13824 75199 75525 98316 98688 ...
output:
180 76
result:
ok single line: '180 76'
Test #14:
score: 0
Accepted
time: 2ms
memory: 6300kb
input:
1000 35291 35312 86789 86866 83062 83162 20865 20944 8746 8775 4343 4424 91150 91245 35038 35089 14655 14730 2368 2400 46003 46077 68570 68587 59768 59861 93211 93243 22297 22362 8014 8102 89783 89787 32162 32260 67653 67732 48474 48573 45358 45427 42929 42937 54261 54328 51557 51573 93091 93168 164...
output:
6 5
result:
ok single line: '6 5'
Test #15:
score: 0
Accepted
time: 2ms
memory: 6252kb
input:
1000 35291 35412 86789 86966 83062 83162 20865 20944 8746 8775 4343 4524 91150 91245 35038 35089 14655 14830 2368 2500 46003 46177 68570 68687 59768 59961 93211 93243 22297 22362 8014 8202 89783 89787 32162 32360 67653 67832 48474 48673 45358 45527 42929 43037 54261 54428 51557 51673 93091 93168 164...
output:
9 6
result:
ok single line: '9 6'
Test #16:
score: 0
Accepted
time: 2ms
memory: 6256kb
input:
1000 35291 35312 86789 87066 83062 83262 20865 21044 8746 8775 4343 4624 91150 91445 35038 35289 14655 14930 2368 2600 46003 46277 68570 68787 59768 59861 93211 93443 22297 22362 8014 8202 89783 89887 32162 32260 67653 67832 48474 48673 45358 45527 42929 43137 54261 54328 51557 51673 93091 93268 164...
output:
11 9
result:
ok single line: '11 9'
Test #17:
score: 0
Accepted
time: 0ms
memory: 6264kb
input:
1000 35291 35612 86789 86966 83062 83162 20865 20944 8746 8775 4343 4524 91150 91445 35038 35289 14655 15030 2368 2700 46003 46377 68570 68887 59768 59961 93211 93243 22297 22562 8014 8402 89783 89787 32162 32560 67653 67832 48474 48873 45358 45727 42929 43037 54261 54628 51557 51673 93091 93368 164...
output:
13 8
result:
ok single line: '13 8'
Test #18:
score: 0
Accepted
time: 2ms
memory: 6324kb
input:
1000 35291 35512 86789 86866 83062 83562 20865 21144 8746 8875 4343 4524 91150 91245 35038 35089 14655 14930 2368 2600 46003 46077 68570 68887 59768 60161 93211 93343 22297 22362 8014 8102 89783 90087 32162 32360 67653 68032 48474 48873 45358 45527 42929 42937 54261 54728 51557 51973 93091 93368 164...
output:
15 10
result:
ok single line: '15 10'
Test #19:
score: 0
Accepted
time: 8ms
memory: 6576kb
input:
20000 35291 35312 86789 86866 83062 83162 20865 20944 8746 8775 4343 4424 91150 91245 35038 35089 14655 14730 2368 2400 46003 46077 68570 68587 59768 59861 93211 93243 22297 22362 8014 8102 89783 89787 32162 32260 67653 67732 48474 48573 45358 45427 42929 42937 54261 54328 51557 51573 93091 93168 16...
output:
51 26
result:
ok single line: '51 26'
Test #20:
score: 0
Accepted
time: 8ms
memory: 6452kb
input:
20000 35291 35412 86789 86966 83062 83162 20865 20944 8746 8775 4343 4524 91150 91245 35038 35089 14655 14830 2368 2500 46003 46177 68570 68687 59768 59961 93211 93243 22297 22362 8014 8202 89783 89787 32162 32360 67653 67832 48474 48673 45358 45527 42929 43037 54261 54428 51557 51673 93091 93168 16...
output:
83 39
result:
ok single line: '83 39'
Test #21:
score: 0
Accepted
time: 6ms
memory: 6496kb
input:
20000 35291 35312 86789 87066 83062 83262 20865 21044 8746 8775 4343 4624 91150 91445 35038 35289 14655 14930 2368 2600 46003 46277 68570 68787 59768 59861 93211 93443 22297 22362 8014 8202 89783 89887 32162 32260 67653 67832 48474 48673 45358 45527 42929 43137 54261 54328 51557 51673 93091 93268 16...
output:
119 53
result:
ok single line: '119 53'
Test #22:
score: 0
Accepted
time: 4ms
memory: 6468kb
input:
20000 35291 35612 86789 86966 83062 83162 20865 20944 8746 8775 4343 4524 91150 91445 35038 35289 14655 15030 2368 2700 46003 46377 68570 68887 59768 59961 93211 93243 22297 22562 8014 8402 89783 89787 32162 32560 67653 67832 48474 48873 45358 45727 42929 43037 54261 54628 51557 51673 93091 93368 16...
output:
152 63
result:
ok single line: '152 63'
Test #23:
score: 0
Accepted
time: 0ms
memory: 6232kb
input:
5 1 100 99 200 199 300 299 400 399 500
output:
3 2
result:
ok single line: '3 2'
Test #24:
score: 0
Accepted
time: 9ms
memory: 6452kb
input:
20000 35291 35512 86789 86866 83062 83562 20865 21144 8746 8875 4343 4524 91150 91245 35038 35089 14655 14930 2368 2600 46003 46077 68570 68887 59768 60161 93211 93343 22297 22362 8014 8102 89783 90087 32162 32360 67653 68032 48474 48873 45358 45527 42929 42937 54261 54728 51557 51973 93091 93368 16...
output:
186 78
result:
ok single line: '186 78'
Test #25:
score: 0
Accepted
time: 0ms
memory: 6252kb
input:
1000 54747 54834 58169 58211 21426 21468 24073 24151 60802 60868 14859 14885 51394 51435 603 646 68265 68342 17202 17299 12516 12560 13439 13499 32274 32323 23886 23925 68469 68569 63455 63471 45137 45213 90007 90070 52916 52996 66291 66361 79695 79745 19993 20082 62889 62938 282 336 13923 14007 174...
output:
6 4
result:
ok single line: '6 4'
Test #26:
score: 0
Accepted
time: 2ms
memory: 6236kb
input:
1000 54747 54934 58169 58211 21426 21568 24073 24251 60802 60868 14859 14985 51394 51535 603 646 68265 68442 17202 17299 12516 12660 13439 13499 32274 32323 23886 24025 68469 68669 63455 63471 45137 45313 90007 90170 52916 52996 66291 66361 79695 79845 19993 20082 62889 63038 282 436 13923 14007 174...
output:
9 7
result:
ok single line: '9 7'
Test #27:
score: 0
Accepted
time: 2ms
memory: 6192kb
input:
1000 54747 54834 58169 58411 21426 21468 24073 24151 60802 60868 14859 14985 51394 51535 603 746 68265 68442 17202 17399 12516 12560 13439 13699 32274 32323 23886 24025 68469 68769 63455 63671 45137 45213 90007 90070 52916 53196 66291 66461 79695 79945 19993 20182 62889 63138 282 336 13923 14007 174...
output:
11 7
result:
ok single line: '11 7'
Test #28:
score: 0
Accepted
time: 2ms
memory: 6260kb
input:
1000 54747 55134 58169 58211 21426 21568 24073 24251 60802 60868 14859 15185 51394 51535 603 646 68265 68442 17202 17499 12516 12860 13439 13499 32274 32523 23886 24025 68469 68869 63455 63471 45137 45513 90007 90170 52916 52996 66291 66361 79695 80045 19993 20282 62889 63038 282 636 13923 14207 174...
output:
13 9
result:
ok single line: '13 9'
Test #29:
score: 0
Accepted
time: 0ms
memory: 6208kb
input:
1000 54747 55234 58169 58611 21426 21868 24073 24451 60802 61068 14859 15285 51394 51635 603 946 68265 68742 17202 17599 12516 12660 13439 13699 32274 32423 23886 24325 68469 68769 63455 63671 45137 45613 90007 90070 52916 52996 66291 66361 79695 79845 19993 20082 62889 63338 282 436 13923 14407 174...
output:
15 9
result:
ok single line: '15 9'
Test #30:
score: 0
Accepted
time: 8ms
memory: 6496kb
input:
20000 54747 54834 58169 58211 21426 21468 24073 24151 60802 60868 14859 14885 51394 51435 603 646 68265 68342 17202 17299 12516 12560 13439 13499 32274 32323 23886 23925 68469 68569 63455 63471 45137 45213 90007 90070 52916 52996 66291 66361 79695 79745 19993 20082 62889 62938 282 336 13923 14007 17...
output:
50 26
result:
ok single line: '50 26'
Test #31:
score: 0
Accepted
time: 5ms
memory: 6572kb
input:
20000 54747 54934 58169 58211 21426 21568 24073 24251 60802 60868 14859 14985 51394 51535 603 646 68265 68442 17202 17299 12516 12660 13439 13499 32274 32323 23886 24025 68469 68669 63455 63471 45137 45313 90007 90170 52916 52996 66291 66361 79695 79845 19993 20082 62889 63038 282 436 13923 14007 17...
output:
87 40
result:
ok single line: '87 40'
Test #32:
score: 0
Accepted
time: 4ms
memory: 6460kb
input:
20000 54747 54834 58169 58411 21426 21468 24073 24151 60802 60868 14859 14985 51394 51535 603 746 68265 68442 17202 17399 12516 12560 13439 13699 32274 32323 23886 24025 68469 68769 63455 63671 45137 45213 90007 90070 52916 53196 66291 66461 79695 79945 19993 20182 62889 63138 282 336 13923 14007 17...
output:
117 56
result:
ok single line: '117 56'
Test #33:
score: 0
Accepted
time: 8ms
memory: 6576kb
input:
20000 54747 55134 58169 58211 21426 21568 24073 24251 60802 60868 14859 15185 51394 51535 603 646 68265 68442 17202 17499 12516 12860 13439 13499 32274 32523 23886 24025 68469 68869 63455 63471 45137 45513 90007 90170 52916 52996 66291 66361 79695 80045 19993 20282 62889 63038 282 636 13923 14207 17...
output:
150 74
result:
ok single line: '150 74'
Test #34:
score: 0
Accepted
time: 1ms
memory: 6264kb
input:
8 1 100 100 200 200 300 300 400 400 500 300 301 399 400 199 201
output:
3 2
result:
ok single line: '3 2'
Test #35:
score: 0
Accepted
time: 8ms
memory: 6492kb
input:
20000 54747 55234 58169 58611 21426 21868 24073 24451 60802 61068 14859 15285 51394 51635 603 946 68265 68742 17202 17599 12516 12660 13439 13699 32274 32423 23886 24325 68469 68769 63455 63671 45137 45613 90007 90070 52916 52996 66291 66361 79695 79845 19993 20082 62889 63338 282 436 13923 14407 17...
output:
186 75
result:
ok single line: '186 75'
Test #36:
score: 0
Accepted
time: 5ms
memory: 6472kb
input:
19999 1 181 181 361 361 541 541 721 721 901 901 1081 1081 1261 1261 1441 1441 1621 1621 1801 1801 1981 1981 2161 2161 2341 2341 2521 2521 2701 2701 2881 2881 3061 3061 3241 3241 3421 3421 3601 3601 3781 3781 3961 3961 4141 4141 4321 4321 4501 4501 4681 4681 4861 4861 5041 5041 5221 5221 5401 5401 55...
output:
110 110
result:
ok single line: '110 110'
Test #37:
score: 0
Accepted
time: 5ms
memory: 6476kb
input:
19999 1 95 95 189 189 283 283 377 377 471 471 565 565 659 659 753 753 847 847 941 941 1035 1035 1129 1129 1223 1223 1317 1317 1411 1411 1505 1505 1599 1599 1693 1693 1787 1787 1881 1881 1975 1975 2069 2069 2163 2163 2257 2257 2351 2351 2445 2445 2539 2539 2633 2633 2727 2727 2821 2821 2915 2915 3009...
output:
210 210
result:
ok single line: '210 210'
Test #38:
score: 0
Accepted
time: 2ms
memory: 6440kb
input:
19999 1 65 65 129 129 193 193 257 257 321 321 385 385 449 449 513 513 577 577 641 641 705 705 769 769 833 833 897 897 961 961 1025 1025 1089 1089 1153 1153 1217 1217 1281 1281 1345 1345 1409 1409 1473 1473 1537 1537 1601 1601 1665 1665 1729 1729 1793 1793 1857 1857 1921 1921 1985 1985 2049 2049 2113...
output:
310 310
result:
ok single line: '310 310'
Test #39:
score: 0
Accepted
time: 7ms
memory: 6528kb
input:
20000 1 10001 10001 20001 20001 30001 30001 40001 40001 50001 50001 60001 60001 70001 70001 80001 80001 90001 90001 100000 9384 9391 2778 2794 7794 7810 5387 5400 6650 6652 2363 2371 8691 8711 7764 7771 541 548 9173 9190 5212 5221 2568 2578 5783 5794 2863 2867 4068 4084 3930 3933 4023 4042 3070 3078...
output:
19991 42
result:
ok single line: '19991 42'
Test #40:
score: 0
Accepted
time: 5ms
memory: 6452kb
input:
20000 1 199 199 397 397 595 595 793 793 991 991 1189 1189 1387 1387 1585 1585 1783 1783 1981 1981 2179 2179 2377 2377 2575 2575 2773 2773 2971 2971 3169 3169 3367 3367 3565 3565 3763 3763 3961 3961 4159 4159 4357 4357 4555 4555 4753 4753 4951 4951 5149 5149 5347 5347 5545 5545 5743 5743 5941 5941 61...
output:
100 100
result:
ok single line: '100 100'
Test #41:
score: 0
Accepted
time: 8ms
memory: 6452kb
input:
20000 1 6667 6667 13333 13333 19999 19999 26665 26665 33331 33331 39997 39997 46663 46663 53329 53329 59995 59995 66661 66661 73327 73327 79993 79993 86659 86659 93325 93325 99991 99991 100000 9384 9391 2778 2794 7794 7810 5387 5400 6650 6652 2363 2371 8691 8711 7764 7771 541 548 9173 9190 5212 5221...
output:
13339 43
result:
ok single line: '13339 43'
Test #42:
score: 0
Accepted
time: 5ms
memory: 6528kb
input:
20000 1 100 100 199 199 298 298 397 397 496 496 595 595 694 694 793 793 892 892 991 991 1090 1090 1189 1189 1288 1288 1387 1387 1486 1486 1585 1585 1684 1684 1783 1783 1882 1882 1981 1981 2080 2080 2179 2179 2278 2278 2377 2377 2476 2476 2575 2575 2674 2674 2773 2773 2872 2872 2971 2971 3070 3070 31...
output:
200 200
result:
ok single line: '200 200'
Test #43:
score: 0
Accepted
time: 7ms
memory: 6496kb
input:
20000 1 5001 5001 10001 10001 15001 15001 20001 20001 25001 25001 30001 30001 35001 35001 40001 40001 45001 45001 50001 50001 55001 55001 60001 60001 65001 65001 70001 70001 75001 75001 80001 80001 85001 85001 90001 90001 95001 95001 100000 9384 9391 2778 2794 7794 7810 5387 5400 6650 6652 2363 2371...
output:
10008 44
result:
ok single line: '10008 44'
Test #44:
score: 0
Accepted
time: 2ms
memory: 6548kb
input:
20000 1 67 67 133 133 199 199 265 265 331 331 397 397 463 463 529 529 595 595 661 661 727 727 793 793 859 859 925 925 991 991 1057 1057 1123 1123 1189 1189 1255 1255 1321 1321 1387 1387 1453 1453 1519 1519 1585 1585 1651 1651 1717 1717 1783 1783 1849 1849 1915 1915 1981 1981 2047 2047 2113 2113 2179...
output:
300 300
result:
ok single line: '300 300'
Test #45:
score: -100
Wrong Answer
time: 28ms
memory: 8944kb
input:
200000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100...
output:
3392 200000
result:
wrong answer 1st lines differ - expected: '200000 200000', found: '3392 200000'