QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321708 | #6385. Swords | KKT89 | 100 ✓ | 20ms | 3976kb | C++17 | 991b | 2024-02-05 08:51:19 | 2024-02-05 08:51:19 |
Judging History
answer
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<pair<int,int>> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i].first >> v[i].second;
}
sort(v.rbegin(), v.rend());
int cnt = 0;
int mx = -1;
for (int i = 0; i < n; ) {
if (mx < v[i].second) {
cnt += 1;
mx = v[i].second;
}
int a = v[i].first;
while (i < n and v[i].first == a) {
i += 1;
}
}
cout << cnt << endl;
}
详细
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3648kb
input:
1 963837006 731841442
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2 948507270 461613425 139535653 575270914
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
10 319645572 758298525 812547177 459359946 355467212 304450522 807957797 916787906 239781206 242840396 862552539 873867121 975802175 647540462 425058513 132645393 542726039 946723283 689442435 88379179
output:
4
result:
ok single line: '4'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
500 324871127 81437847 409475382 449147781 489822349 623579845 541818045 840744984 661020437 969739509 798121975 645320144 816860092 800579487 824869844 529655705 465683506 749124928 598994662 884712609 209267210 57701594 429537250 605036253 621863743 894173810 124365859 688557442 292413610 13087016...
output:
6
result:
ok single line: '6'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
500 683386324 317939718 208613330 798920975 579714620 453381531 345595104 665823464 800877748 211763934 789188460 220973054 588560958 451627488 959388230 76567736 313310279 714219110 533824766 510880778 6504202 999158405 909358811 119409841 889857953 140960955 862319883 173370354 568240503 463420167...
output:
395
result:
ok single line: '395'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
1 489 292
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 175 214 91 452
output:
2
result:
ok single line: '2'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
500 1 997543246 2 995357372 3 988412728 4 986531882 5 947990795 6 986096885 7 985088729 8 983384861 9 981967299 10 981275019 11 981138741 12 979753640 13 978444166 14 977719824 15 97805033 16 974499206 17 973089608 18 971207207 19 966150552 20 966131944 21 965920975 22 965854903 23 962837830 24 9578...
output:
451
result:
ok single line: '451'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1 409449117 374415292
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2 639986533 546618522 919895908 441292940
output:
2
result:
ok single line: '2'
Subtask #2:
score: 21
Accepted
Test #11:
score: 21
Accepted
time: 1ms
memory: 3588kb
input:
5000 335 370 93 303 246 51 165 259 316 29 272 282 43 25 475 268 124 326 10 161 268 309 351 349 8 130 16 313 381 433 133 293 176 154 84 213 323 315 244 180 18 368 177 184 452 122 233 128 151 337 409 419 487 500 62 440 484 333 489 245 331 62 272 218 22 481 234 89 93 188 123 312 57 278 129 152 496 437 ...
output:
5
result:
ok single line: '5'
Test #12:
score: 0
Accepted
time: 13ms
memory: 3880kb
input:
100000 412 237 111 427 185 315 53 378 111 185 41 185 302 457 464 33 211 313 343 31 246 309 126 209 43 94 362 155 385 422 2 291 122 137 423 305 64 366 16 228 497 344 355 339 112 421 462 333 446 95 295 325 379 274 436 355 342 51 287 37 468 400 295 107 53 457 370 412 174 185 205 54 470 419 47 182 257 4...
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 17ms
memory: 3880kb
input:
100000 390 87 172 49 88 312 315 193 110 133 22 53 256 38 310 99 206 179 100 177 249 178 104 278 108 143 71 127 32 453 298 15 17 263 252 36 105 260 249 87 297 88 210 81 308 131 31 263 196 152 99 275 162 162 104 58 62 198 163 118 190 30 263 44 284 158 22 230 158 326 118 38 75 329 20 380 497 1 444 56 2...
output:
422
result:
ok single line: '422'
Test #14:
score: 0
Accepted
time: 12ms
memory: 3880kb
input:
100000 18 352 9 253 15 435 183 44 80 82 67 274 156 271 74 285 177 314 82 165 264 112 264 157 112 336 30 276 392 31 308 3 299 50 130 153 321 153 256 137 234 95 134 163 268 15 83 410 442 38 144 201 118 156 232 259 332 120 166 173 116 135 86 21 281 208 334 116 197 161 388 73 136 327 335 85 159 65 137 2...
output:
396
result:
ok single line: '396'
Subtask #3:
score: 34
Accepted
Test #15:
score: 34
Accepted
time: 0ms
memory: 3752kb
input:
1000 1 999364420 2 998447750 3 998101971 4 997565306 5 997218128 6 996453842 7 996346759 8 991821522 9 991345816 10 991124285 11 989916443 12 989465292 13 988065411 14 987961309 15 986603323 16 986161187 17 984463465 18 983735350 19 982870592 20 981837956 21 979637953 22 979158794 23 977305448 24 97...
output:
943
result:
ok single line: '943'
Test #16:
score: 0
Accepted
time: 12ms
memory: 3940kb
input:
100000 1 35016634 2 42570102 3 347690764 4 483516799 5 999979181 6 1 7 2 8 3 9 10 10 40 11 137 12 235 13 357 14 548 15 3550 16 4870 17 11918 18 16779 19 5106657 20 10114779 21 137389249 22 335861312 23 999827272 24 1 25 6 26 7 27 9 28 37 29 38 30 48 31 63 32 74 33 91 34 1711 35 5585 36 13633 37 3558...
output:
4744
result:
ok single line: '4744'
Test #17:
score: 0
Accepted
time: 9ms
memory: 3944kb
input:
100000 1 999989351 2 999976087 3 999973310 4 999960176 5 999955133 6 999945409 7 999933763 8 999902669 9 999902401 10 999895604 11 999880436 12 999876699 13 999860487 14 999854211 15 999842500 16 713698866 17 999818348 18 999812344 19 999811697 20 999785649 21 999782175 22 999772263 23 999770919 24 ...
output:
97638
result:
ok single line: '97638'
Test #18:
score: 0
Accepted
time: 12ms
memory: 3976kb
input:
100000 1 999997530 2 999977818 3 999956899 4 999953914 5 999933909 6 999909867 7 999898862 8 210007646 9 999895909 10 999893707 11 999892420 12 999890065 13 999884821 14 999867925 15 999840734 16 999837128 17 884505152 18 999807351 19 999787905 20 999785432 21 999781766 22 999772786 23 999737283 24 ...
output:
88337
result:
ok single line: '88337'
Subtask #4:
score: 25
Accepted
Dependency #3:
100%
Accepted
Test #19:
score: 25
Accepted
time: 0ms
memory: 3568kb
input:
5000 554036067 447419575 286571996 702600238 355155911 638389056 138742887 859308810 426700873 569828281 166143489 837972502 850362290 148284081 706854249 287910860 705585203 290062193 587961228 408879212 478810178 518539205 989868658 7423751 937379090 61602176 150815345 849392767 909788438 90994179...
output:
3670
result:
ok single line: '3670'
Test #20:
score: 0
Accepted
time: 19ms
memory: 3880kb
input:
100000 510479463 489292222 933537611 65376980 622558020 377265239 650814330 348371850 729588024 269635598 666967836 296576516 424502231 575332084 928127088 70737745 160552520 837900430 510866167 488723996 136944270 861973154 441695499 557661942 34626465 963043950 609500361 391209630 350038714 648308...
output:
71698
result:
ok single line: '71698'
Test #21:
score: 0
Accepted
time: 19ms
memory: 3936kb
input:
100000 440683823 555666479 370463398 627313426 843032758 154413002 773489219 223267323 252841664 746386660 531007267 464589165 774112697 222641939 11708952 987832338 906599107 92423704 745878756 250192254 155251647 843204032 72172292 926641348 980482192 18675319 536765120 458331670 349658830 6484030...
output:
73931
result:
ok single line: '73931'
Test #22:
score: 0
Accepted
time: 20ms
memory: 3880kb
input:
100000 691972163 306626531 513749351 482632470 163706777 832285992 238007985 758488213 457133340 539281994 415628894 580976712 199948635 796200303 112637259 883560329 875619404 122413776 796396333 200411626 380549127 137681042 653419158 346047011 952312013 47157989 225410688 771255665 329035804 6671...
output:
67457
result:
ok single line: '67457'
Subtask #5:
score: 9
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #23:
score: 9
Accepted
time: 1ms
memory: 3632kb
input:
5000 287076166 710303115 396277102 605036274 996528636 3553568 560250356 433828980 971846877 25779608 368825319 633948416 730777435 261271835 574610725 421896460 643766947 350372173 129968467 873953227 602537688 394057577 694668645 291245442 610745538 383576445 280255021 713287414 572223902 42539030...
output:
4132
result:
ok single line: '4132'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
10000 638338492 72539722 317269324 190204986 657256402 17306617 347175272 628993532 520163877 471523633 939816104 65311765 146047231 850138577 233560335 764982177 199089366 798721832 82588288 911477199 705590120 297512974 793166327 43217892 470508561 527812031 99194356 786599256 65459296 929717031 9...
output:
5958
result:
ok single line: '5958'
Test #25:
score: 0
Accepted
time: 13ms
memory: 3872kb
input:
100000 60110096 132230446 493015787 241582555 680128562 320347188 656920774 344693572 366225961 634651399 692415899 111162767 453206647 296911737 320322804 681941513 755934215 104304191 770181698 229443866 138446965 695168057 575457546 425465822 218575038 783979271 185352550 816842004 431204441 5698...
output:
64824
result:
ok single line: '64824'
Test #26:
score: 0
Accepted
time: 19ms
memory: 3948kb
input:
100000 78121946 922142592 900135833 98630556 337946285 659504133 180816053 819435820 546568640 451801227 555120516 443354665 649185585 348820659 776989863 220551416 505461291 492513380 484604649 512427220 942948119 56911319 70238302 929755480 109824510 891448948 870507245 128260881 649258177 3487659...
output:
84588
result:
ok single line: '84588'
Test #27:
score: 0
Accepted
time: 20ms
memory: 3864kb
input:
100000 253614967 278270961 980235896 498158919 928430171 216003120 852570559 948400591 239257297 897053668 294741177 38297442 382677591 406314558 609468974 854148233 314532768 738191552 158215003 5865826 920471827 380037059 356271729 749175328 28319050 208101106 953758996 896570759 521930645 2413736...
output:
14
result:
ok single line: '14'
Extra Test:
score: 0
Extra Test Passed