QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#296157 | #7953. Product Delivery | defyers# | AC ✓ | 93ms | 11432kb | C++17 | 690b | 2024-01-02 11:48:50 | 2024-01-02 11:48:52 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 11;
int a[N][2];
void solve(int TC) {
int n; cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i][0] >> a[i][1];
}
int ans = 0, upper = 0;
for(int i = n - 1; i >= 0; i--){
if(upper > a[i][1]){
upper = a[i][1];
}else if(upper < a[i][0]){
upper = a[i][1];
ans++;
}
}
cout << ans << '\n';
}
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
solve(i);
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3604kb
input:
4 13 15 5 8 6 14 3 7
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3336kb
input:
5 1 2 2 3 33 44 4 5 6 7
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
5 10 20 3 6 13 30 7 8 11 13
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
10000 9915 10554 10838 11379 11776 12657 12806 12963 13167 13833 14451 15021 14759 16130 16101 16780 16879 17295 17659 18207 18136 18705 19184 20065 20015 20660 20265 21316 21804 22253 21954 23283 22862 24108 24131 24588 24337 25510 25451 26586 26724 27483 27211 28088 28107 29022 28947 29794 29924 3...
output:
10
result:
ok single line: '10'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
10000 9573 10124 10578 10742 11109 12182 12532 12917 13140 13884 13751 15238 15247 15518 15807 16483 16933 17964 17583 18882 18320 19167 19744 20237 20776 21056 21337 22594 22321 23558 22856 24308 23626 24973 25395 26206 26037 26618 27290 27450 28214 28696 28639 29369 29607 30493 30814 31602 31189 3...
output:
100
result:
ok single line: '100'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
10000 6362 6874 6728 7647 8211 8515 8557 9634 9900 10372 10833 11620 11204 12102 12622 12716 13454 14355 13765 14489 14990 15900 15388 16690 16354 17076 17380 18620 18109 19444 18877 19868 20405 20721 21379 22033 22029 22344 23013 23743 23187 24862 24286 25690 25269 26077 26321 26718 26661 27965 280...
output:
20
result:
ok single line: '20'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
10000 6461 7187 7338 7755 7430 8215 8052 8487 8654 9043 9362 9471 9616 10117 10413 10780 10773 10969 10937 11441 11746 11951 12359 12732 12517 13215 13196 13613 13534 14010 14127 14666 14734 15379 15318 15698 16033 16511 16239 16736 16731 17560 17470 17811 17924 18184 18345 19052 18707 19460 19141 2...
output:
50
result:
ok single line: '50'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
10000 224 1039 1343 2072 1815 2710 3197 3438 3957 4264 4984 5577 5791 6395 5941 6960 7255 7423 7736 8789 1540 1915 2172 3061 3442 3716 3863 5157 5040 5601 6233 6930 7083 7596 7965 8517 8490 9929 10041 11059 11079 11775 11615 12746 12853 13201 13064 14417 14290 15551 15191 16677 16668 17793 17425 178...
output:
500
result:
ok single line: '500'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
10000 6256380 6256816 6255649 6256246 6255120 6255151 6254471 6254803 6253878 6254143 6253183 6253293 6252650 6253019 6251906 6251975 6251307 6251517 6250657 6250816 6250073 6250188 6249440 6249973 6248909 6249272 6248530 6248556 6248045 6248069 6246975 6247247 6246437 6246768 6245895 6245953 624504...
output:
10000
result:
ok single line: '10000'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
10000 9446 9501 9529 9656 10226 10250 11148 11183 11438 11508 12155 12173 12661 13149 13312 13355 13912 14147 14693 14696 15195 15203 15914 16353 16785 16902 17436 17550 17730 18199 18627 18773 19067 19208 19775 19854 20176 20236 21226 21327 21392 21500 22129 22527 22872 22997 23673 23750 24096 2438...
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
10000 405 10831 1214 7121 495 2805 1476 5976 845 6238 3871 5850 1056 6749 2076 9606 1867 10561 302 10055 7141 9115 916 3134 2164 3511 922 6470 5308 11064 6298 10388 6847 8032 6486 9046 6582 7476 5650 10921 847 1442 3676 6282 1162 8017 3836 6361 4746 7522 2626 8797 8076 11095 9313 10069 1782 9286 115...
output:
2272
result:
ok single line: '2272'
Test #12:
score: 0
Accepted
time: 10ms
memory: 4224kb
input:
100000 9915 10554 10838 11379 11776 12657 12806 12963 13167 13833 14451 15021 14759 16130 16101 16780 16879 17295 17659 18207 18136 18705 19184 20065 20015 20660 20265 21316 21804 22253 21954 23283 22862 24108 24131 24588 24337 25510 25451 26586 26724 27483 27211 28088 28107 29022 28947 29794 29924 ...
output:
10
result:
ok single line: '10'
Test #13:
score: 0
Accepted
time: 10ms
memory: 4220kb
input:
100000 9573 10124 10578 10742 11109 12182 12532 12917 13140 13884 13751 15238 15247 15518 15807 16483 16933 17964 17583 18882 18320 19167 19744 20237 20776 21056 21337 22594 22321 23558 22856 24308 23626 24973 25395 26206 26037 26618 27290 27450 28214 28696 28639 29369 29607 30493 30814 31602 31189 ...
output:
100
result:
ok single line: '100'
Test #14:
score: 0
Accepted
time: 10ms
memory: 4164kb
input:
100000 6362 6874 6728 7647 8211 8515 8557 9634 9900 10372 10833 11620 11204 12102 12622 12716 13454 14355 13765 14489 14990 15900 15388 16690 16354 17076 17380 18620 18109 19444 18877 19868 20405 20721 21379 22033 22029 22344 23013 23743 23187 24862 24286 25690 25269 26077 26321 26718 26661 27965 28...
output:
20
result:
ok single line: '20'
Test #15:
score: 0
Accepted
time: 6ms
memory: 4176kb
input:
100000 6461 7187 7338 7755 7430 8215 8052 8487 8654 9043 9362 9471 9616 10117 10413 10780 10773 10969 10937 11441 11746 11951 12359 12732 12517 13215 13196 13613 13534 14010 14127 14666 14734 15379 15318 15698 16033 16511 16239 16736 16731 17560 17470 17811 17924 18184 18345 19052 18707 19460 19141 ...
output:
50
result:
ok single line: '50'
Test #16:
score: 0
Accepted
time: 4ms
memory: 4224kb
input:
100000 10067 10708 10513 11993 11402 12460 12095 13159 13564 14198 14356 14623 14865 15870 15806 16671 16422 16913 16972 17965 18420 19064 18958 19551 19929 20150 20551 21383 20992 22103 21886 23275 23039 23614 23487 24553 24545 25511 25219 26099 26087 26839 26920 27524 27517 28795 28823 29038 29428...
output:
500
result:
ok single line: '500'
Test #17:
score: 0
Accepted
time: 11ms
memory: 4224kb
input:
100000 62506380 62506816 62505649 62506246 62505120 62505151 62504471 62504803 62503878 62504143 62503183 62503293 62502650 62503019 62501906 62501975 62501307 62501517 62500657 62500816 62500073 62500188 62499440 62499973 62498909 62499272 62498530 62498556 62498045 62498069 62496975 62497247 62496...
output:
100000
result:
ok single line: '100000'
Test #18:
score: 0
Accepted
time: 12ms
memory: 4172kb
input:
100000 9446 9501 9529 9656 10226 10250 11148 11183 11438 11508 12155 12173 12661 13149 13312 13355 13912 14147 14693 14696 15195 15203 15914 16353 16785 16902 17436 17550 17730 18199 18627 18773 19067 19208 19775 19854 20176 20236 21226 21327 21392 21500 22129 22527 22872 22997 23673 23750 24096 243...
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 9ms
memory: 4236kb
input:
100000 405 10831 1214 7121 495 2805 1476 5976 845 6238 3871 5850 1056 6749 2076 9606 1867 10561 302 10055 7141 9115 916 3134 2164 3511 922 6470 5308 11064 6298 10388 6847 8032 6486 9046 6582 7476 5650 10921 847 1442 3676 6282 1162 8017 3836 6361 4746 7522 2626 8797 8076 11095 9313 10069 1782 9286 11...
output:
22758
result:
ok single line: '22758'
Test #20:
score: 0
Accepted
time: 92ms
memory: 11256kb
input:
1000000 1869 2662 2491 3484 2917 3933 3787 4650 4311 5392 5190 6184 6296 6743 6465 7804 7678 8554 8459 9244 9075 9795 9731 10350 10337 11257 11333 11660 11974 12656 12284 13324 13433 13862 13968 15015 14386 15745 15548 16338 16025 16782 17069 17872 17725 18225 18431 18992 19096 19905 19934 20619 200...
output:
10
result:
ok single line: '10'
Test #21:
score: 0
Accepted
time: 83ms
memory: 11152kb
input:
1000000 3699 4638 4513 4830 4763 5482 5985 6692 6423 6961 7172 8004 7627 8286 8420 9303 8870 9983 10022 10273 10290 10802 11102 11837 11996 12403 12644 13357 13277 13754 13778 14636 14668 14752 15349 15943 15506 16469 16557 17367 17363 17550 17915 18296 18393 18943 18804 19820 19894 20499 20636 2097...
output:
100
result:
ok single line: '100'
Test #22:
score: 0
Accepted
time: 91ms
memory: 11200kb
input:
1000000 8653 8919 9156 9857 9960 10550 10539 10714 11186 11824 11871 12646 12435 12823 13191 13331 13413 14400 14179 15162 14977 15772 15825 16266 16268 16613 16841 17612 17624 18286 18161 18781 18952 19336 19314 19771 20074 20995 21041 21204 21183 21872 22224 22450 22627 23196 23611 24099 24112 245...
output:
20
result:
ok single line: '20'
Test #23:
score: 0
Accepted
time: 79ms
memory: 11260kb
input:
1000000 9160 10481 10707 11020 11128 12020 12342 13265 13441 13553 13871 14748 14445 15810 16069 16329 17049 18024 17172 18118 18412 19823 19014 19924 20215 21118 20806 21792 22225 22942 23202 23999 23591 24518 24795 26126 25939 26804 26822 27388 27182 28757 28088 29270 29589 29868 30572 31224 31189...
output:
50
result:
ok single line: '50'
Test #24:
score: 0
Accepted
time: 81ms
memory: 11432kb
input:
1000000 2484 3275 3439 3801 3588 4421 4088 4902 4972 5760 5301 6311 6153 6870 6428 7063 7424 8176 7817 8530 8564 9181 9216 9386 9379 10143 10226 10598 10555 11481 11696 11767 11982 12837 12606 13260 13419 13662 13986 14104 14160 14964 15136 15697 15548 16055 15929 16503 16821 17222 17512 17993 17794...
output:
500
result:
ok single line: '500'
Test #25:
score: 0
Accepted
time: 86ms
memory: 11260kb
input:
1000000 628006396 628006444 628005873 628006213 628005051 628005198 628004653 628004989 628004155 628004295 628003215 628003434 628002576 628002663 628002032 628002194 628001258 628001332 628000708 628000714 628000013 628000573 627999442 627999489 627998972 627999237 627998450 627998618 627997496 62...
output:
1000000
result:
ok single line: '1000000'
Test #26:
score: 0
Accepted
time: 93ms
memory: 11424kb
input:
1000000 9796 10193 10434 10481 10915 11145 11903 12109 12219 12671 12923 13066 13464 13548 14030 14338 14732 14736 15370 15857 15925 15982 16657 17033 17396 17670 17804 18130 18854 18907 19309 19510 19799 19998 20504 20611 21120 21211 21702 22046 22583 22728 23144 23398 23522 24054 24245 24347 25201...
output:
1
result:
ok single line: '1'
Test #27:
score: 0
Accepted
time: 83ms
memory: 11256kb
input:
1000000 405 10831 1214 7121 495 2805 1476 5976 845 6238 3871 5850 1056 6749 2076 9606 1867 10561 302 10055 7141 9115 916 3134 2164 3511 922 6470 5308 11064 6298 10388 6847 8032 6486 9046 6582 7476 5650 10921 847 1442 3676 6282 1162 8017 3836 6361 4746 7522 2626 8797 8076 11095 9313 10069 1782 9286 1...
output:
228620
result:
ok single line: '228620'