QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#865432 | #8122. Zatopljenje | Unforgettablepl# | 110 ✓ | 95ms | 25964kb | C++20 | 1.1kb | 2025-01-21 18:34:24 | 2025-01-21 18:34:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct fenwick {
vector<int> tree;
fenwick(int n):tree(n+1){};
void add(int k,int x){
while(k<tree.size()){
tree[k]+=x;
k+=k&-k;
}
}
int get(int k){
int ans = 0;
while(k){
ans+=tree[k];
k-=k&-k;
}
return ans;
}
};
int32_t main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n,q;
cin >> n >> q;
vector<tuple<int,bool,int,int,int>> events;
for(int i=1;i<=n;i++){
int h;cin>>h;
events.emplace_back(h,false,i,i,i);
}
for(int i=1;i<=q;i++){
int l,r,x;
cin >> l >> r >> x;
events.emplace_back(x,true,l,r,i);
}
vector<bool> present(n+2);
vector<int> anss(q+1);
fenwick tree(n);
sort(events.rbegin(),events.rend());
for(auto[t,type,l,r,idx]:events){
if(type){
int ans = tree.get(r)-tree.get(l-1);
if(present[l] and present[l-1])ans++;
anss[idx]=ans;
} else {
present[l]=true;
tree.add(l,1);
if(present[l-1])tree.add(l,-1);
if(present[l+1])tree.add(l+1,-1);
}
}
for(int i=1;i<=q;i++)cout<<anss[i]<<'\n';
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 2ms
memory: 3820kb
input:
2000 2000 150 261 262 337 311 235 132 256 15 113 196 282 188 269 143 55 226 253 290 130 44 45 93 258 88 0 155 298 273 104 33 101 137 106 302 368 316 87 312 297 353 89 170 374 93 34 281 277 219 266 169 327 283 164 47 345 52 140 50 343 350 93 4 348 228 259 399 96 58 400 179 244 223 392 327 319 293 172...
output:
23 259 12 22 145 223 13 261 234 56 246 39 141 35 14 34 123 2 160 3 27 210 262 55 26 174 159 8 16 6 5 11 188 25 40 56 16 19 149 136 1 1 37 15 16 257 199 56 231 294 18 1 3 19 45 34 156 51 119 12 9 59 10 45 323 9 31 76 45 1 1 66 75 80 45 176 79 440 8 90 134 5 321 74 100 63 27 16 5 61 12 23 45 79 4 75 6...
result:
ok 2000 lines
Test #2:
score: 10
Accepted
time: 0ms
memory: 3840kb
input:
2000 2000 110 165 437 738 13 766 319 253 572 625 634 443 508 769 327 412 356 360 799 301 726 782 306 516 294 555 656 21 265 158 678 143 583 331 695 654 350 728 361 750 561 144 175 571 569 209 127 472 283 333 570 379 190 650 685 452 545 255 703 506 300 21 206 800 382 146 504 738 225 399 676 619 308 4...
output:
178 7 22 5 20 320 70 17 96 349 38 8 38 6 247 309 12 28 234 79 8 65 246 20 16 129 70 6 195 2 41 11 86 50 30 138 23 269 301 37 109 221 131 181 5 50 37 99 16 182 2 199 1 2 74 173 41 12 425 81 0 3 162 185 7 339 4 343 11 7 14 1 3 105 92 238 153 152 10 242 50 2 4 128 0 91 62 54 59 48 13 175 191 317 167 22...
result:
ok 2000 lines
Test #3:
score: 10
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 1039 491 903 306 1101 855 1016 619 754 46 544 889 136 452 192 530 227 57 34 704 715 398 77 27 958 222 643 1129 780 1034 6 316 423 214 496 843 95 631 875 860 913 510 174 544 331 37 474 1092 381 519 323 520 549 758 392 365 299 528 314 973 771 634 906 141 1007 860 93 190 322 480 1148 454 795 ...
output:
3 30 94 4 2 208 81 100 117 291 33 12 42 44 69 376 32 163 117 5 25 268 71 72 58 37 78 46 74 129 3 97 28 33 45 276 305 19 65 4 38 7 92 123 399 53 55 34 1 34 16 168 100 1 16 23 257 16 64 236 17 18 129 184 49 170 83 108 40 132 19 58 39 220 53 90 284 214 122 129 35 272 1 22 18 18 122 23 66 33 50 23 5 347...
result:
ok 2000 lines
Test #4:
score: 10
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 1305 758 594 1136 16 30 1005 1299 46 76 975 1198 588 136 1252 1296 1229 76 719 368 952 421 358 989 1508 107 310 210 477 916 1328 386 176 896 394 1122 1361 1483 972 672 110 1228 1168 85 288 1505 507 446 1020 243 412 444 505 533 8 220 577 1571 668 533 648 64 718 676 1379 1042 377 1496 843 16...
output:
96 29 10 0 53 9 37 11 34 24 190 8 5 149 61 44 161 98 37 41 101 18 331 1 50 0 168 2 147 4 130 167 4 26 90 135 38 287 130 41 107 7 1 20 14 10 57 15 51 106 74 257 53 93 60 22 28 11 218 17 20 9 139 235 136 181 64 3 106 21 50 62 28 3 53 29 235 24 96 22 40 225 9 197 227 5 46 101 29 13 13 66 4 94 78 45 79 ...
result:
ok 2000 lines
Test #5:
score: 10
Accepted
time: 1ms
memory: 3940kb
input:
2000 2000 71 1800 774 1133 1954 431 1032 290 415 1230 251 618 30 1238 715 1481 1268 99 1457 67 1690 1782 4 953 1574 755 76 732 1059 1336 1379 424 1670 800 827 1989 1885 342 1235 445 1049 96 1546 1743 1869 1069 1766 551 229 1735 1489 1750 1622 1575 1064 31 1600 121 32 1755 400 313 953 114 1989 867 11...
output:
60 51 12 150 249 20 86 5 28 117 4 54 53 175 54 17 19 20 8 0 108 22 7 2 13 180 15 27 38 40 78 120 125 175 311 106 6 49 34 3 31 2 156 8 22 200 91 97 9 5 160 40 22 0 93 107 56 85 121 91 12 19 29 216 59 25 76 57 6 86 106 42 41 2 0 263 21 147 35 233 141 61 64 48 2 270 10 104 169 227 126 19 65 34 30 5 263...
result:
ok 2000 lines
Test #6:
score: 10
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 1000 997 994 991 989 987 984 981 981 981 981 980 980 979 978 976 976 976 975 975 975 974 972 969 969 966 966 964 964 962 962 962 961 961 961 959 958 957 956 956 955 954 952 952 952 951 950 950 949 948 948 947 944 941 940 939 938 938 937 936 930 930 929 929 929 929 928 926 926 926 925 925 9...
output:
0 2 2 1 1 2 1 0 2 1 1 0 2 2 2 0 0 1 0 0 0 1 2 1 1 0 2 1 0 2 0 0 0 2 2 0 0 2 0 0 2 2 0 0 0 1 0 2 0 2 2 1 0 2 2 2 1 1 2 1 0 2 1 1 2 1 1 2 2 0 2 0 0 2 1 2 0 2 0 0 1 1 1 2 2 2 2 2 0 2 0 2 0 2 1 0 0 2 2 1 1 1 2 2 2 1 2 0 1 1 1 2 0 1 0 2 2 0 0 1 1 1 1 0 1 1 2 1 1 0 2 0 0 0 1 1 0 2 1 2 1 0 2 0 1 1 2 2 1 0 ...
result:
ok 2000 lines
Test #7:
score: 10
Accepted
time: 1ms
memory: 3948kb
input:
2000 2000 1000 997 997 997 996 996 996 994 993 992 992 991 991 990 989 988 988 988 988 985 982 982 982 982 980 978 978 974 974 973 971 971 971 971 970 970 969 968 968 967 967 967 966 965 964 964 962 962 959 959 958 957 957 955 954 953 952 951 951 951 948 948 947 945 945 944 941 941 939 939 939 939 9...
output:
2 1 1 2 0 2 2 2 1 1 0 0 2 0 1 1 2 2 1 2 1 1 0 2 1 0 2 2 1 0 2 2 2 2 2 1 0 0 0 1 2 2 0 1 1 0 0 1 1 2 0 2 0 2 1 2 1 1 0 0 2 1 1 0 1 0 1 2 2 1 1 0 1 1 2 2 2 1 2 2 2 2 0 0 2 2 0 1 2 2 1 1 0 1 1 2 2 1 2 1 1 0 0 0 1 2 0 0 0 0 0 0 2 2 1 0 0 0 1 1 0 2 0 1 1 0 1 2 0 1 1 0 2 2 1 2 2 0 2 0 1 1 2 2 1 2 2 0 0 0 ...
result:
ok 2000 lines
Test #8:
score: 10
Accepted
time: 1ms
memory: 3944kb
input:
2000 2000 999 999 999 998 998 997 995 995 994 992 991 991 990 990 989 987 987 986 986 984 983 983 983 981 980 980 980 979 979 978 976 975 975 975 972 971 970 970 969 969 969 969 965 965 963 963 960 959 958 958 957 956 955 953 952 952 951 951 951 951 949 948 946 945 945 945 945 944 941 940 940 940 93...
output:
0 0 1 2 1 0 2 0 2 0 0 2 2 2 2 0 1 2 0 0 2 1 1 1 1 0 0 1 1 0 0 2 2 1 2 2 1 2 2 0 0 2 2 0 0 2 2 1 1 1 2 1 0 1 0 2 1 1 2 2 2 1 0 1 2 1 0 2 1 2 2 2 0 2 1 2 1 2 0 0 2 1 2 0 0 0 1 2 1 1 0 2 0 1 0 0 1 1 1 2 1 2 1 1 1 0 0 0 0 0 0 1 2 1 2 1 0 1 2 0 0 2 2 2 2 0 0 1 0 0 0 0 1 1 1 0 1 2 0 0 2 2 0 1 1 1 2 2 2 0 ...
result:
ok 2000 lines
Test #9:
score: 10
Accepted
time: 0ms
memory: 3816kb
input:
2000 2000 43 33 43 49 35 21 10 10 38 10 3 22 10 41 2 15 25 7 0 31 21 7 6 26 6 24 19 47 0 36 18 26 17 22 42 25 19 9 40 17 11 0 35 7 18 17 18 26 37 41 49 10 47 11 11 46 23 3 38 9 12 19 14 32 31 50 26 45 4 44 0 7 42 30 4 42 43 46 13 27 35 9 35 4 2 18 18 38 3 48 43 43 25 17 17 50 50 14 19 8 5 39 10 49 1...
output:
47 108 95 2 49 54 43 34 2 90 4 5 4 71 101 14 28 56 4 155 26 130 23 1 72 99 114 103 40 34 215 10 24 162 232 95 244 19 17 214 43 11 8 210 177 1 28 15 136 34 58 288 65 5 115 2 95 0 76 26 4 120 17 36 7 157 84 6 148 226 54 22 114 3 174 122 8 14 248 74 51 60 78 117 138 5 31 260 99 191 117 56 225 4 18 196 ...
result:
ok 2000 lines
Test #10:
score: 10
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 24 16 42 46 19 45 1 28 4 1 34 49 45 25 39 25 33 39 1 7 40 49 28 44 12 36 48 37 22 6 33 0 5 35 44 37 0 50 48 6 43 8 22 46 45 20 36 29 50 21 6 7 22 15 28 18 15 47 17 17 14 44 45 0 47 47 0 11 37 12 21 38 24 46 46 2 44 50 16 47 38 44 16 5 8 44 40 43 16 23 44 45 34 14 44 24 47 27 46 4 26 8 40 4...
output:
27 119 141 3 67 23 45 91 12 32 91 56 17 21 145 118 396 10 18 177 261 62 34 29 159 75 160 250 41 48 14 3 173 75 4 158 221 75 34 32 10 40 13 278 400 95 130 138 40 12 343 12 6 71 101 201 99 0 11 62 100 158 39 16 33 8 28 9 9 4 166 116 29 1 7 66 56 21 78 271 3 6 35 29 16 32 2 6 31 70 16 92 74 130 75 7 38...
result:
ok 2000 lines
Subtask #2:
score: 20
Accepted
Test #11:
score: 20
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 1247 588 901 1726 1573 999 956 1968 108 1485 717 1130 1723 1499 537 281 870 1441 491 1650 86 398 179 419 1706 1257 451 1864 1035 238 1471 1496 62 811 1253 1755 1925 1723 1467 387 466 718 875 1640 1422 309 397 65 464 340 1307 1438 1944 1092 1995 224 263 1616 164 1282 361 9 1418 1416 117 124...
output:
381 4 502 439 483 489 99 390 457 274 458 502 351 419 437 383 306 247 467 118 243 462 502 358 21 491 165 15 491 358 443 354 165 21 117 434 473 411 475 28 295 379 187 478 504 55 491 364 497 301 439 457 391 494 66 155 9 498 491 444 411 327 339 408 52 503 422 411 224 53 371 424 498 208 159 268 356 490 4...
result:
ok 2000 lines
Test #12:
score: 20
Accepted
time: 49ms
memory: 14608kb
input:
2000 200000 1343 841 1512 432 506 1035 1615 995 1799 1073 1769 1662 1410 224 1090 227 1182 602 132 149 702 1261 251 370 248 1056 1977 602 508 862 1343 1469 626 255 1691 497 1861 1124 469 1462 329 835 1989 1064 1686 1173 428 63 555 1819 704 250 122 1641 473 439 951 1224 64 952 1327 1111 998 889 1723 ...
output:
497 232 226 198 494 451 476 443 421 312 504 387 265 386 297 495 475 487 330 470 261 477 489 449 119 280 105 19 440 473 18 506 450 460 476 63 235 373 507 451 499 428 186 264 482 286 490 359 216 150 306 357 418 306 378 280 327 503 15 375 82 379 402 20 210 453 112 45 486 431 466 495 247 459 499 379 193...
result:
ok 200000 lines
Test #13:
score: 20
Accepted
time: 39ms
memory: 14700kb
input:
100000 100000 109939 140150 182977 101278 135450 163849 16707 128390 66777 161671 110877 50627 121937 26465 33562 187570 117193 4166 193997 112997 82975 102254 185677 13641 124285 178397 198115 95036 119879 118508 114096 2593 145789 122634 135742 42116 195776 13312 90459 112181 41633 148567 113400 1...
output:
20155 23162 11673 24810 13613 18867 7200 16134 10494 23982 15169 17933 20433 21464 20313 20437 24480 6884 1967 20132 22068 15876 14060 6232 20869 23302 13423 21045 13764 24625 6437 22683 8926 18358 22850 2077 23286 14997 24547 6978 23124 265 3055 9511 10307 18147 20759 23113 3626 6584 14752 12579 48...
result:
ok 100000 lines
Test #14:
score: 20
Accepted
time: 90ms
memory: 25960kb
input:
200000 200000 68564 70474 140129 19856 93153 174524 148576 198657 179192 21544 169587 61104 57311 52251 176742 195606 154297 196693 144085 167711 24411 31269 171624 81003 38996 104317 104128 189206 187035 193443 116180 173739 79739 74238 27905 33168 129482 165326 140252 116743 175906 195699 126855 1...
output:
49742 22902 20176 25056 38214 50013 15850 9884 36938 49287 44628 41230 38488 41400 49734 7028 38703 49698 12092 31812 44135 19223 49391 49165 10564 18371 50097 32846 34499 13449 50099 40023 41982 36336 49187 29043 22073 41719 17062 49994 35306 7199 46920 50009 44831 49747 47235 44905 30457 48214 476...
result:
ok 200000 lines
Test #15:
score: 20
Accepted
time: 81ms
memory: 25960kb
input:
200000 200000 472630320 262148500 163081089 120482639 383614526 871023387 862028528 17000389 994536564 466808220 407812562 12554819 690330207 118281069 706017077 136001083 805276238 967142441 253007421 41107194 420243347 108749118 918619463 883206955 421113125 35265199 125323221 886802804 200259928 ...
output:
7038 24003 45333 17351 12642 48457 40591 49532 18308 31412 12693 48996 42637 35724 49839 49588 7039 48224 40361 45852 47148 49762 19593 49529 41406 39249 42892 34801 44178 33020 48658 2683 925 45278 7883 431 46628 14877 21992 38224 44274 36949 33348 45239 3465 48246 7593 24443 40280 49606 38725 4769...
result:
ok 200000 lines
Test #16:
score: 20
Accepted
time: 92ms
memory: 25964kb
input:
200000 200000 1076 1672 30 935 120 725 329 1082 1833 285 204 162 849 889 1993 810 1676 167 1077 1103 1202 813 772 67 1606 1172 1961 612 15 1981 181 572 310 998 132 784 644 752 403 762 952 1616 1700 370 911 1797 866 1425 1073 1323 514 462 1902 1036 903 873 1692 1779 1868 703 1187 767 1811 248 1022 11...
output:
25515 47751 40501 35433 28725 38688 15566 48501 14126 34119 48216 11165 11884 47548 31881 43707 40644 45577 49993 46439 48380 44217 24796 25948 39856 49953 47289 22039 1667 38923 48750 43831 48162 46824 49606 49206 39295 50031 24841 37925 30216 13303 3672 46911 17971 40773 28454 43985 50059 26587 29...
result:
ok 200000 lines
Test #17:
score: 20
Accepted
time: 84ms
memory: 25964kb
input:
200000 200000 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 9...
output:
2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 1 2000 2000 2000 2000 200...
result:
ok 200000 lines
Test #18:
score: 20
Accepted
time: 84ms
memory: 25960kb
input:
200000 200000 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 9...
output:
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 ...
result:
ok 200000 lines
Test #19:
score: 20
Accepted
time: 85ms
memory: 25960kb
input:
200000 200000 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 9...
output:
40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 ...
result:
ok 200000 lines
Test #20:
score: 20
Accepted
time: 31ms
memory: 14700kb
input:
200000 2000 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 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2000 lines
Subtask #3:
score: 20
Accepted
Test #21:
score: 20
Accepted
time: 0ms
memory: 3948kb
input:
2000 2000 998 998 998 996 996 996 996 995 994 992 991 989 989 986 986 984 983 980 979 975 975 974 973 972 970 968 966 966 965 964 962 961 961 959 959 957 955 954 954 953 953 952 952 951 949 947 947 946 944 944 943 943 942 941 940 939 938 937 936 935 934 932 931 930 928 928 928 927 926 926 923 923 92...
output:
0 1 1 0 1 0 2 0 2 2 0 0 0 1 1 0 1 1 0 1 0 1 1 0 2 0 0 0 0 2 0 0 1 0 0 2 2 0 0 0 2 1 1 1 0 2 0 1 1 1 2 2 0 0 1 2 2 1 0 0 1 0 1 2 1 1 2 0 2 1 2 1 2 2 2 0 2 0 0 0 1 1 0 2 2 2 1 2 2 0 2 1 2 0 0 0 0 2 2 1 1 0 1 1 1 2 1 1 0 1 0 0 1 1 2 1 1 0 0 0 2 2 0 2 2 2 2 0 0 2 1 1 0 0 0 0 0 1 0 1 2 2 1 0 0 1 0 2 1 2 ...
result:
ok 2000 lines
Test #22:
score: 20
Accepted
time: 9ms
memory: 6760kb
input:
20000 20000 10000 9999 9999 9998 9997 9997 9996 9994 9994 9994 9993 9993 9992 9992 9992 9991 9991 9988 9988 9987 9981 9981 9978 9978 9978 9976 9975 9974 9973 9971 9967 9966 9965 9964 9964 9964 9962 9962 9961 9957 9956 9954 9954 9953 9950 9948 9947 9947 9947 9947 9944 9944 9942 9940 9939 9938 9938 99...
output:
0 0 2 2 2 1 0 2 2 0 1 0 1 2 1 0 2 1 0 1 2 2 0 1 0 2 2 0 2 0 2 1 1 0 0 2 1 2 0 2 0 0 1 0 0 1 1 1 1 2 0 1 0 0 1 0 0 1 1 1 2 0 2 1 0 0 1 2 1 0 1 2 0 1 0 0 1 0 1 0 2 0 1 2 0 0 0 1 0 2 1 1 0 2 2 0 0 2 2 1 1 1 0 2 2 1 0 2 2 0 1 2 2 1 1 1 2 0 1 1 2 1 2 1 1 1 2 0 2 1 1 2 1 2 2 2 0 2 0 1 1 0 0 1 0 2 0 1 0 0 ...
result:
ok 20000 lines
Test #23:
score: 20
Accepted
time: 87ms
memory: 25956kb
input:
200000 200000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1...
output:
0 1 2 0 1 2 0 0 0 2 2 0 1 0 0 1 2 1 1 0 1 2 2 2 2 0 2 1 1 2 2 2 2 1 2 0 1 2 0 2 2 2 1 1 0 2 2 1 1 0 2 2 2 0 0 1 0 2 1 2 0 0 2 0 2 0 0 0 0 0 2 0 1 0 2 2 1 0 0 0 2 1 0 2 2 2 1 0 0 2 1 0 1 1 0 2 0 2 2 0 1 1 0 2 2 2 0 2 1 2 2 1 0 0 0 0 0 0 0 1 1 1 2 1 1 1 1 1 0 2 1 0 1 2 2 0 1 2 1 2 2 2 1 2 2 2 1 1 1 1 ...
result:
ok 200000 lines
Test #24:
score: 20
Accepted
time: 87ms
memory: 25964kb
input:
200000 200000 100000 100000 100000 99999 99999 99999 99998 99996 99995 99994 99994 99993 99992 99991 99991 99990 99990 99989 99988 99988 99988 99988 99987 99984 99983 99983 99982 99982 99978 99978 99976 99974 99972 99971 99971 99970 99970 99970 99969 99968 99968 99966 99964 99964 99963 99963 99962 9...
output:
0 0 2 1 2 0 0 0 1 2 0 0 0 0 0 2 1 0 1 1 2 0 0 0 1 2 0 1 2 0 1 1 2 2 2 0 1 1 1 0 0 2 1 2 0 0 2 2 2 1 0 2 2 2 1 2 0 1 1 0 2 0 1 0 1 1 2 1 0 1 1 2 0 1 0 0 0 2 2 1 2 1 0 1 1 2 0 0 0 1 2 0 1 2 2 2 0 0 2 1 0 2 1 2 0 2 1 0 1 2 2 0 0 0 1 2 0 2 0 1 0 1 0 2 2 1 2 0 0 2 0 0 0 1 0 1 2 2 0 2 1 1 1 0 1 0 0 0 2 2 ...
result:
ok 200000 lines
Test #25:
score: 20
Accepted
time: 91ms
memory: 25960kb
input:
200000 200000 999601480 999069625 999007656 998983728 998915661 998572246 998536516 998479823 998169982 998125773 997832901 997830799 997804403 997793659 997701992 997481856 997480214 997441686 997348938 997348651 997252566 997235429 997211694 997174069 997127075 997017219 996964366 996765244 996731...
output:
0 1 0 0 2 2 1 0 2 1 2 1 2 1 2 2 1 0 0 2 0 1 0 1 2 2 2 2 2 0 1 2 0 1 1 1 0 1 2 1 2 0 1 2 2 1 2 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 2 2 1 2 2 0 0 1 1 0 2 0 0 1 2 0 2 0 0 2 2 1 0 1 1 1 2 2 1 1 0 2 1 0 0 2 1 2 1 2 1 2 0 1 0 1 1 1 2 0 2 2 2 2 1 0 0 0 0 0 1 1 1 2 0 0 2 1 1 1 0 1 1 2 2 0 0 2 0 1 0 0 2 0 2 ...
result:
ok 200000 lines
Test #26:
score: 20
Accepted
time: 86ms
memory: 25960kb
input:
200000 200000 999970712 999952277 999925033 999921363 999910631 999877426 999863059 999844558 999843428 999812481 999811444 999787444 999769195 999735752 999696492 999662601 999651190 999582905 999571906 999566365 999562750 999526404 999492491 999483046 999457255 999453788 999452978 999439702 999433...
output:
0 0 2 0 2 2 2 2 2 0 1 2 2 0 1 2 2 1 0 1 1 2 1 1 0 2 1 0 1 1 1 2 2 1 1 0 1 2 1 0 0 1 1 2 1 2 0 0 1 0 0 1 2 2 0 0 2 0 2 1 0 0 2 0 2 2 1 0 1 2 1 2 2 1 1 0 0 0 1 0 2 2 1 1 0 2 2 0 1 2 1 2 0 2 2 0 1 0 0 0 1 1 1 1 0 2 0 0 1 1 2 2 0 1 1 0 0 2 2 2 1 0 0 2 0 0 0 1 2 1 0 2 0 2 0 1 1 0 1 2 0 2 1 2 1 2 0 0 1 1 ...
result:
ok 200000 lines
Test #27:
score: 20
Accepted
time: 90ms
memory: 25956kb
input:
200000 200000 999969896 999968363 999950471 999943098 999927121 999901086 999896153 999893140 999881660 999876023 999866261 999865032 999864419 999831469 999827334 999823824 999820800 999804777 999799372 999798872 999798659 999783664 999782425 999781758 999780240 999752337 999743759 999736431 999731...
output:
0 0 2 2 2 2 1 0 0 0 1 2 1 0 0 1 2 2 2 1 0 2 1 1 1 0 0 2 0 2 0 1 1 0 0 2 0 1 0 2 0 0 0 1 0 1 1 2 0 1 1 1 2 1 0 0 2 2 2 2 1 0 0 1 1 2 2 0 0 1 2 2 1 2 2 2 0 2 1 1 0 0 2 1 1 1 0 0 1 2 2 0 2 1 2 0 1 1 1 1 2 1 1 0 0 1 1 0 2 0 2 1 2 1 1 1 2 1 1 1 1 1 1 0 2 0 2 0 0 0 0 2 0 1 2 2 2 1 1 2 0 1 1 0 2 1 0 1 0 1 ...
result:
ok 200000 lines
Test #28:
score: 20
Accepted
time: 90ms
memory: 25960kb
input:
200000 200000 999997061 999986135 999982209 999977902 999975052 999974102 999966363 999960108 999956808 999948848 999945519 999940047 999939106 999928232 999928146 999926485 999924046 999919588 999915318 999913435 999903729 999900354 999900319 999898247 999896712 999896552 999890707 999885112 999882...
output:
1 2 2 2 2 2 1 2 1 2 1 1 0 0 2 0 0 1 0 2 2 2 1 0 0 1 1 2 0 0 0 1 2 0 2 1 0 0 2 2 1 0 0 0 0 1 0 2 2 2 2 1 2 2 1 0 2 0 0 0 1 2 2 0 1 2 1 1 1 2 2 1 2 1 0 1 2 1 2 1 2 1 1 1 0 0 0 0 2 2 1 1 0 1 0 1 2 2 2 1 0 2 1 1 0 2 1 2 2 0 2 0 2 1 1 0 2 0 1 0 0 0 1 0 1 1 2 0 2 2 2 2 2 0 0 1 0 0 1 1 2 1 2 2 2 1 0 1 0 0 ...
result:
ok 200000 lines
Test #29:
score: 20
Accepted
time: 82ms
memory: 25960kb
input:
200000 200000 997657695 997583399 992737098 992628486 969380886 960446781 945925670 932911200 926722750 916009973 912826106 903498256 889095966 872131872 867743906 839339634 824086751 821387452 816740839 811213948 797943505 785754656 782841671 781690465 750597705 749271843 748087915 745199994 735379...
output:
1 2 2 0 1 1 0 2 2 1 1 1 2 0 1 2 1 1 2 1 1 0 1 0 1 2 0 2 0 2 2 1 1 2 2 2 2 1 0 0 2 2 2 2 2 2 1 0 1 0 0 0 1 1 0 0 2 2 1 2 2 2 2 2 1 1 0 0 0 1 0 1 2 2 2 1 0 2 0 1 2 2 1 1 1 1 1 0 2 2 1 2 2 2 1 1 1 0 2 1 2 2 0 1 2 0 2 0 0 2 1 1 2 2 0 0 2 0 1 1 0 1 0 2 2 1 2 1 2 2 1 1 2 1 1 1 1 1 0 2 0 1 0 0 0 1 0 1 1 1 ...
result:
ok 200000 lines
Test #30:
score: 20
Accepted
time: 89ms
memory: 25964kb
input:
200000 200000 999999595 999991293 999989921 999986750 999981771 999977291 999975082 999974607 999969994 999965778 999956447 999956146 999954735 999949833 999949083 999928384 999927227 999922320 999914811 999907133 999906583 999901014 999893475 999887831 999878896 999878409 999871802 999868150 999866...
output:
1 0 0 2 2 0 1 2 0 1 2 0 0 0 0 2 1 1 1 0 1 0 2 1 2 0 1 0 2 0 1 1 2 1 2 1 1 2 2 2 1 0 2 1 1 0 0 2 2 0 2 0 0 1 2 2 2 2 2 1 1 1 2 1 1 1 1 2 0 0 1 2 0 2 2 1 1 0 2 2 0 0 0 0 2 1 2 0 0 2 1 2 1 1 2 0 0 2 2 0 2 0 0 2 2 0 0 1 1 1 1 0 1 0 0 1 2 0 0 2 2 0 0 1 0 2 0 1 1 2 0 1 1 0 1 2 2 0 1 2 2 0 0 1 0 2 1 2 2 2 ...
result:
ok 200000 lines
Subtask #4:
score: 60
Accepted
Test #31:
score: 60
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 3321 3258 4574 2506 400 4390 1081 3138 1171 3612 326 1620 2720 2469 779 2061 396 2799 1678 3272 1686 2520 3439 4130 631 3584 2661 1856 2834 1777 4958 2499 2550 4723 3568 4930 4972 2528 94 538 4450 1776 166 3167 814 4726 4279 4993 2112 942 4038 272 493 3130 3527 370 4630 4322 480 2958 2170 ...
output:
27 282 9 83 230 49 31 27 18 146 89 67 164 146 25 5 57 23 9 22 282 126 169 58 100 30 6 84 58 97 135 33 6 67 102 54 32 5 74 1 64 38 318 14 97 118 97 1 155 78 20 119 42 146 52 18 28 81 16 21 83 342 36 23 5 5 66 70 17 49 301 172 225 59 30 130 111 1 4 6 254 172 75 118 189 100 0 18 47 146 68 192 31 147 15...
result:
ok 2000 lines
Test #32:
score: 60
Accepted
time: 9ms
memory: 6760kb
input:
20000 20000 36964 10984 38806 38552 15439 12763 21933 45978 38927 19985 14371 30157 23662 9186 11447 10476 30583 25891 3183 4374 35454 22629 33431 42922 5380 26741 12976 12960 39862 6426 9298 27199 39454 39062 1247 44100 31803 12226 36187 46997 28369 35686 35303 38664 16476 33850 38685 31158 40761 4...
output:
636 2374 130 99 1863 129 4882 849 452 1371 187 282 471 727 511 1552 1255 692 17 341 185 130 362 54 365 1256 1344 1491 244 541 1856 306 515 1866 2081 1164 500 2420 2831 132 295 1010 237 1161 1935 3621 5 640 833 731 1985 96 1083 306 588 564 26 37 2737 0 190 101 1188 580 15 3229 2773 23 3658 5 1274 459...
result:
ok 20000 lines
Test #33:
score: 60
Accepted
time: 42ms
memory: 15336kb
input:
200000 20000 2587 4840 4094 2618 4340 4641 3989 2546 2179 3601 266 4849 620 4211 3941 456 4517 3049 2519 3095 3887 1481 197 2040 1801 1678 841 130 2918 4138 1015 3370 770 4815 4485 58 1793 1488 1716 1275 1154 178 2100 1905 4859 829 3557 3224 2248 3809 4163 3206 202 1294 489 4608 2094 1023 1594 3617 ...
output:
1048 6168 1915 852 8989 2817 10 155 24149 9396 1566 12 13376 33860 2839 139 35832 28017 5642 2286 8954 10885 6390 332 3258 451 9265 1311 812 15163 9965 3180 466 6660 825 14316 3339 699 3822 35385 647 457 43193 16290 2862 13106 5336 2961 25194 23956 15997 681 22899 7883 7660 6378 11936 6514 2930 1924...
result:
ok 20000 lines
Test #34:
score: 60
Accepted
time: 95ms
memory: 25956kb
input:
200000 200000 44583 5825 263254 212610 67255 381466 152475 384870 447001 47874 126998 92893 147305 483976 128115 384480 45490 191895 407971 87260 477954 413335 223937 471856 452640 487695 117376 379160 422894 429744 395095 364840 195835 230600 236479 380193 57782 313064 487212 7280 410208 180932 195...
output:
4141 1793 9862 228 5348 5316 11395 2979 10939 3779 3007 8864 5382 5489 1159 7580 40016 16803 6376 378 10294 11893 511 193 2417 4143 1213 16771 6849 303 7578 911 7458 10937 408 1848 962 1848 14193 3846 12330 389 28355 7631 598 3921 19429 5066 7951 40786 8284 3278 17105 1116 2019 32 4894 39 28819 4047...
result:
ok 200000 lines
Test #35:
score: 60
Accepted
time: 90ms
memory: 25956kb
input:
200000 200000 10043244 33450306 568323784 61584928 240652395 551572034 548382963 149400515 736500797 827290019 603695072 145827105 319465814 83681482 285833829 334622433 728478070 462770509 604244345 634827289 269001858 217384199 222312060 46400844 115102992 117167265 209296719 880567936 167735572 3...
output:
13542 27240 6044 311 18156 8420 14665 9155 3017 6872 811 4979 17938 4423 3645 16512 6662 36194 2531 257 12364 881 1900 6453 379 25979 5627 23955 10683 10119 716 4771 26206 6844 2611 2200 5145 10894 819 20347 18434 5807 9555 3146 4900 555 276 9893 5077 3016 12926 6314 181 16338 3716 14078 1838 32372 ...
result:
ok 200000 lines
Test #36:
score: 60
Accepted
time: 88ms
memory: 25960kb
input:
200000 200000 999989728 999978784 999975757 999940070 999926758 999904186 999870677 999854974 999830407 999820437 999814928 999812163 999811080 999809982 999795358 999778154 999771550 999771399 999770753 999761746 999750584 999742762 999730325 999725700 999722157 999711779 999695730 999691553 999676...
output:
2 0 1 1 2 0 1 2 0 0 2 0 1 2 2 1 2 2 1 2 2 2 1 2 0 2 0 2 1 1 1 2 1 1 0 1 1 1 0 1 2 2 1 0 2 0 0 2 2 1 2 1 0 1 0 0 2 1 1 2 2 1 0 1 2 0 1 0 2 0 1 2 0 0 0 1 0 1 1 0 1 2 0 1 0 1 2 0 2 0 2 0 2 0 2 0 0 0 0 2 2 1 0 0 1 0 1 0 1 2 0 2 0 1 2 1 0 2 0 0 2 1 0 1 2 0 1 2 0 1 2 1 2 0 2 2 2 1 0 2 0 0 2 0 0 2 1 0 1 1 ...
result:
ok 200000 lines
Test #37:
score: 60
Accepted
time: 86ms
memory: 25924kb
input:
200000 200000 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 9...
output:
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 ...
result:
ok 200000 lines
Test #38:
score: 60
Accepted
time: 0ms
memory: 3584kb
input:
20 20 10 43 33 23 17 22 43 22 33 11 30 22 19 16 18 35 49 41 37 0 17 17 8 20 20 3 20 20 50 19 20 47 1 11 50 16 18 32 20 20 25 6 9 2 9 17 1 17 18 29 2 19 33 14 20 11 17 18 2 14 16 41 16 17 40 9 12 20 18 20 15 5 5 33 17 18 6 12 13 43
output:
1 0 0 0 0 1 0 1 1 1 3 1 1 0 1 2 1 0 1 0
result:
ok 20 lines
Test #39:
score: 60
Accepted
time: 0ms
memory: 3944kb
input:
2000 2000 1 2271 1 3226 1 1392 1 4458 1 4170 1 4778 1 2326 1 3716 1 895 1 1058 1 3784 1 2647 1 3444 1 3403 1 4544 1 1996 1 1643 1 4654 1 4761 1 1812 1 643 1 2590 1 2859 1 2780 1 3534 1 937 1 369 1 1759 1 338 1 4026 1 4001 1 2274 1 3781 1 876 1 2134 1 4924 1 3536 1 4424 1 666 1 3620 1 3084 1 474 1 13...
output:
172 337 0 25 17 247 4 177 0 174 33 20 19 319 71 168 123 152 83 29 302 203 56 11 123 80 1 641 58 318 142 438 167 49 2 38 34 37 7 71 14 2 2 288 33 51 38 135 16 32 0 500 7 28 112 13 307 32 546 509 159 3 29 242 19 218 48 16 83 49 125 41 175 38 119 287 5 23 91 560 6 6 108 35 5 26 20 28 56 569 8 152 40 93...
result:
ok 2000 lines
Test #40:
score: 60
Accepted
time: 94ms
memory: 25960kb
input:
200000 200000 1 906164563 1 354144390 1 633700739 1 439930999 1 70148228 1 640571958 1 104097108 1 208753061 1 206868566 1 500859620 1 455496040 1 240393879 1 666880132 1 299130999 1 32385311 1 230541074 1 643510765 1 874518743 1 735450965 1 976248882 1 285809393 1 740787134 1 124233206 1 999967021 ...
output:
15019 3785 3385 2273 2407 10752 636 40293 33115 4232 5744 5221 461 13705 6246 13485 15192 13973 5646 166 3019 11264 20456 6558 48068 26132 2091 551 2543 18868 2232 3271 14181 8405 3531 16033 726 17450 5370 32873 37258 5055 43739 1532 55176 467 10148 55646 17661 14686 22260 14674 594 2109 12056 4123 ...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed