QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#765958 | #9702. Cats line up | propane | AC ✓ | 564ms | 19340kb | C++20 | 3.5kb | 2024-11-20 15:46:45 | 2024-11-20 15:46:51 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<array>
#include<map>
#include<algorithm>
using namespace std;
using LL = long long;
const int mod = 998244353;
// void add(int &a, int b){
// a += b;
// if (a >= mod) a -= mod;
// }
const int maxn = 1e6 + 5;
LL f2[maxn], f3[maxn];
LL dp[6][1 << 4], ndp[6][1 << 4];
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
// k = 3
// 合法相邻的位置有n - 1, n - 2, n - 3, 两面的墙
// 状态数 6 * 2^4
// x | 1 | 2 | 3 | x
// 或许可以对称性压缩状态
int fact[4]{1, 1, 2, 6};
auto solve = [&](int K, LL f[]){
vector<vector<int> > v;
vector<int> a;
for(int i = 1; i <= K; i++){
a.push_back(i);
}
map<vector<int>, int> mp;
do{
mp[a] = v.size();
v.push_back(a);
}while(next_permutation(a.begin(), a.end()));
vector<array<int, 4> > trans;
for(int i = 0; i < fact[K]; i++){
for(int j = 0; j < 1 << (K + 1); j++){
vector<int> q;
q.push_back(0);
for(int k = 0; k < K + 1; k++){
if (j >> k & 1){
q.push_back(-1);
}
if (k < K) q.push_back(v[i][k]);
else q.push_back(0);
}
for(int k = 0; k + 1 < q.size(); k++){
if (q[k] != -1 and q[k + 1] != -1){
auto nxt = q;
nxt.insert(nxt.begin() + k + 1, K + 1);
vector<int> b;
int pos[5], pt = 0;
for(int t = 0; t < nxt.size(); t++){
if (nxt[t] >= 2){
pos[++pt] = t;
b.push_back(nxt[t] - 1);
}
}
pos[0] = 0;
pos[K + 1] = nxt.size() - 1;
int na = mp[b];
int nb = 0;
for(int t = 0; t < K + 1; t++){
nb |= ((pos[t + 1] - pos[t] - 1) >= 1) << t;
}
trans.push_back({i, j, na, nb});
}
}
}
}
for(int i = 1; i <= K; i++){
f[i] = fact[i];
}
memset(dp, 0, sizeof dp);
for(int i = 0; i < fact[K]; i++){
dp[i][0] = 1;
}
for(int i = K + 1; i <= 1000'000; i++){
memset(ndp, 0, sizeof ndp);
for(auto [a, b, c, d] : trans){
ndp[c][d] += dp[a][b];
}
for(int j = 0; j < fact[K]; j++){
for(int k = 0; k < 1 << (K + 1); k++){
ndp[j][k] %= mod;
f[i] += ndp[j][k];
}
}
f[i] %= mod;
swap(dp, ndp);
}
};
solve(3, f3);
solve(2, f2);
int T;
cin >> T;
while(T--){
int n, k;
cin >> n >> k;
if (k == 1){
cout << (n == 1 ? 1 : 2) << '\n';
}
else if (k == 2){
cout << f2[n] << '\n';
}
else{
cout << f3[n] << '\n';
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 468ms
memory: 19228kb
input:
100000 400001 1 400002 1 400003 1 400004 1 400005 1 400006 1 400007 1 400008 1 400009 1 400010 1 400011 1 400012 1 400013 1 400014 1 400015 1 400016 1 400017 1 400018 1 400019 1 400020 1 400021 1 400022 1 400023 1 400024 1 400025 1 400026 1 400027 1 400028 1 400029 1 400030 1 400031 1 400032 1 40003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #2:
score: 0
Accepted
time: 474ms
memory: 19240kb
input:
100000 100001 2 100002 2 100003 2 100004 2 100005 2 100006 2 100007 2 100008 2 100009 2 100010 2 100011 2 100012 2 100013 2 100014 2 100015 2 100016 2 100017 2 100018 2 100019 2 100020 2 100021 2 100022 2 100023 2 100024 2 100025 2 100026 2 100027 2 100028 2 100029 2 100030 2 100031 2 100032 2 10003...
output:
293107232 485780488 340250626 633557862 121294003 461744637 97258156 218752171 680696822 778154994 997107183 679759672 459870335 458933189 140648534 600718897 61607763 202456329 803375260 865183059 69595073 873170373 740309121 810104238 685230304 427495120 239555055 924985411 354436232 594191343 521...
result:
ok 100000 numbers
Test #3:
score: 0
Accepted
time: 468ms
memory: 19336kb
input:
100000 900001 2 900002 2 900003 2 900004 2 900005 2 900006 2 900007 2 900008 2 900009 2 900010 2 900011 2 900012 2 900013 2 900014 2 900015 2 900016 2 900017 2 900018 2 900019 2 900020 2 900021 2 900022 2 900023 2 900024 2 900025 2 900026 2 900027 2 900028 2 900029 2 900030 2 900031 2 900032 2 90003...
output:
454272236 613021354 923334208 381162095 995983455 922873318 307591070 307130184 233559163 542950249 851880451 88995281 633745552 489181674 579976981 217278208 708259912 291792572 510870814 222686409 516279019 30705520 255191971 773271034 805776600 64524266 839595350 648927649 715251969 558403022 210...
result:
ok 100000 numbers
Test #4:
score: 0
Accepted
time: 465ms
memory: 19156kb
input:
100000 200001 3 200002 3 200003 3 200004 3 200005 3 200006 3 200007 3 200008 3 200009 3 200010 3 200011 3 200012 3 200013 3 200014 3 200015 3 200016 3 200017 3 200018 3 200019 3 200020 3 200021 3 200022 3 200023 3 200024 3 200025 3 200026 3 200027 3 200028 3 200029 3 200030 3 200031 3 200032 3 20003...
output:
347255773 651476250 811163915 507878016 311361084 60751702 405520868 268053005 796842957 841527255 310652726 841194111 558013868 443625368 23670295 751715981 547001173 622260427 839941782 681206540 708929172 865660892 589053708 847179076 623499870 12395309 577903714 186239209 869014040 395502613 992...
result:
ok 100000 numbers
Test #5:
score: 0
Accepted
time: 472ms
memory: 19228kb
input:
100000 500001 2 500002 2 500003 2 500004 2 500005 2 500006 2 500007 2 500008 2 500009 2 500010 2 500011 2 500012 2 500013 2 500014 2 500015 2 500016 2 500017 2 500018 2 500019 2 500020 2 500021 2 500022 2 500023 2 500024 2 500025 2 500026 2 500027 2 500028 2 500029 2 500030 2 500031 2 500032 2 50003...
output:
7850298 775538251 34338832 43189134 819727391 855066231 899255375 721738425 579560317 481571355 206065445 786625782 270952806 478018275 267399730 539352564 20126516 288526278 828878876 850005428 141287391 971166307 823927424 966214859 940136859 766819978 735790534 678683092 448258771 186805008 86648...
result:
ok 100000 numbers
Test #6:
score: 0
Accepted
time: 474ms
memory: 19120kb
input:
100000 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61...
output:
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #7:
score: 0
Accepted
time: 468ms
memory: 19052kb
input:
100000 600001 3 600002 3 600003 3 600004 3 600005 3 600006 3 600007 3 600008 3 600009 3 600010 3 600011 3 600012 3 600013 3 600014 3 600015 3 600016 3 600017 3 600018 3 600019 3 600020 3 600021 3 600022 3 600023 3 600024 3 600025 3 600026 3 600027 3 600028 3 600029 3 600030 3 600031 3 600032 3 60003...
output:
675955032 144238409 719244007 411153776 750231644 256550922 513509922 490377903 853256111 739323009 902762103 180762470 263807318 24804088 958439896 851964558 635912778 464507731 682364226 920362774 312039513 829526791 269760684 928396755 181001725 971090800 136986877 515637102 573477812 879961288 7...
result:
ok 100000 numbers
Test #8:
score: 0
Accepted
time: 478ms
memory: 19336kb
input:
100000 600001 2 600002 2 600003 2 600004 2 600005 2 600006 2 600007 2 600008 2 600009 2 600010 2 600011 2 600012 2 600013 2 600014 2 600015 2 600016 2 600017 2 600018 2 600019 2 600020 2 600021 2 600022 2 600023 2 600024 2 600025 2 600026 2 600027 2 600028 2 600029 2 600030 2 600031 2 600032 2 60003...
output:
139689401 934333115 147778660 288668065 225956833 374935501 664803576 891960421 269851583 935855175 830771261 103578511 42389355 874360640 979139177 24484207 900044877 882139733 907823974 810824534 695919952 606699613 420479836 119355479 727255138 150690669 271246198 1457035 153347758 425794012 4284...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 462ms
memory: 19244kb
input:
100000 500001 3 500002 3 500003 3 500004 3 500005 3 500006 3 500007 3 500008 3 500009 3 500010 3 500011 3 500012 3 500013 3 500014 3 500015 3 500016 3 500017 3 500018 3 500019 3 500020 3 500021 3 500022 3 500023 3 500024 3 500025 3 500026 3 500027 3 500028 3 500029 3 500030 3 500031 3 500032 3 50003...
output:
403767808 478993671 332330192 571813959 696688902 474149692 770066073 26193673 197205988 624586217 159363292 142643892 775485941 253585011 341366500 584803591 89978599 980721968 753067566 421460880 907777799 197587189 729114342 575928955 619260849 255472346 221549302 247327739 972583971 941279452 52...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 472ms
memory: 19048kb
input:
100000 300001 1 300002 1 300003 1 300004 1 300005 1 300006 1 300007 1 300008 1 300009 1 300010 1 300011 1 300012 1 300013 1 300014 1 300015 1 300016 1 300017 1 300018 1 300019 1 300020 1 300021 1 300022 1 300023 1 300024 1 300025 1 300026 1 300027 1 300028 1 300029 1 300030 1 300031 1 300032 1 30003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 469ms
memory: 19244kb
input:
100000 200001 2 200002 2 200003 2 200004 2 200005 2 200006 2 200007 2 200008 2 200009 2 200010 2 200011 2 200012 2 200013 2 200014 2 200015 2 200016 2 200017 2 200018 2 200019 2 200020 2 200021 2 200022 2 200023 2 200024 2 200025 2 200026 2 200027 2 200028 2 200029 2 200030 2 200031 2 200032 2 20003...
output:
617590575 60889303 724116806 343863032 405152341 131424802 475687844 881240197 14820660 490908520 374304382 389525062 880833604 257293657 647218745 530208024 787901711 437276135 967884193 757941587 197373407 167413287 925754916 125284014 293097347 221007958 346692022 640189421 861597433 210445158 85...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 554ms
memory: 19172kb
input:
100000 100001 3 100002 3 100003 3 100004 3 100005 3 100006 3 100007 3 100008 3 100009 3 100010 3 100011 3 100012 3 100013 3 100014 3 100015 3 100016 3 100017 3 100018 3 100019 3 100020 3 100021 3 100022 3 100023 3 100024 3 100025 3 100026 3 100027 3 100028 3 100029 3 100030 3 100031 3 100032 3 10003...
output:
93335691 627179740 475616389 171154587 959541060 561789787 345241356 536355580 54393211 870429181 120869856 316886359 349723392 892835796 713140524 399916584 823657228 829867597 173687818 622515532 581722076 123725595 857402341 253980719 203888803 678008980 168152397 11513395 58734308 301764011 3897...
result:
ok 100000 numbers
Test #13:
score: 0
Accepted
time: 457ms
memory: 19308kb
input:
100000 700001 2 700002 2 700003 2 700004 2 700005 2 700006 2 700007 2 700008 2 700009 2 700010 2 700011 2 700012 2 700013 2 700014 2 700015 2 700016 2 700017 2 700018 2 700019 2 700020 2 700021 2 700022 2 700023 2 700024 2 700025 2 700026 2 700027 2 700028 2 700029 2 700030 2 700031 2 700032 2 70003...
output:
928635615 838202894 503149027 434940293 276298840 780847875 218943825 496642677 280646213 500990054 788396 282834629 785224705 787413125 73403427 860028160 650596962 725400421 588584262 242336907 969137366 560877315 804614264 776907321 340940329 148710288 927017659 271113687 421224029 351397391 6239...
result:
ok 100000 numbers
Test #14:
score: 0
Accepted
time: 474ms
memory: 19048kb
input:
100000 800001 3 800002 3 800003 3 800004 3 800005 3 800006 3 800007 3 800008 3 800009 3 800010 3 800011 3 800012 3 800013 3 800014 3 800015 3 800016 3 800017 3 800018 3 800019 3 800020 3 800021 3 800022 3 800023 3 800024 3 800025 3 800026 3 800027 3 800028 3 800029 3 800030 3 800031 3 800032 3 80003...
output:
306279385 20016426 137143413 449660056 296084540 358911417 261982742 589558822 291893968 643544053 402314189 27040463 829133430 394293253 865917942 72760817 944983936 284204901 588851484 939463794 518486109 58837080 269813834 292761884 553397535 953354439 109579279 12055641 594830860 908287611 77766...
result:
ok 100000 numbers
Test #15:
score: 0
Accepted
time: 482ms
memory: 19228kb
input:
100000 900001 1 900002 1 900003 1 900004 1 900005 1 900006 1 900007 1 900008 1 900009 1 900010 1 900011 1 900012 1 900013 1 900014 1 900015 1 900016 1 900017 1 900018 1 900019 1 900020 1 900021 1 900022 1 900023 1 900024 1 900025 1 900026 1 900027 1 900028 1 900029 1 900030 1 900031 1 900032 1 90003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #16:
score: 0
Accepted
time: 482ms
memory: 19308kb
input:
100000 900001 3 900002 3 900003 3 900004 3 900005 3 900006 3 900007 3 900008 3 900009 3 900010 3 900011 3 900012 3 900013 3 900014 3 900015 3 900016 3 900017 3 900018 3 900019 3 900020 3 900021 3 900022 3 900023 3 900024 3 900025 3 900026 3 900027 3 900028 3 900029 3 900030 3 900031 3 900032 3 90003...
output:
532826315 530171290 18622494 453801323 107261393 577348744 912999082 961842034 606843023 59701135 636758337 21869640 596955746 548035392 705672379 939873686 552743940 534756503 993806804 685476148 163229506 372428960 554866581 871218039 938346738 372219887 20965368 989852572 441001370 249309088 7080...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 474ms
memory: 19340kb
input:
100000 800001 2 800002 2 800003 2 800004 2 800005 2 800006 2 800007 2 800008 2 800009 2 800010 2 800011 2 800012 2 800013 2 800014 2 800015 2 800016 2 800017 2 800018 2 800019 2 800020 2 800021 2 800022 2 800023 2 800024 2 800025 2 800026 2 800027 2 800028 2 800029 2 800030 2 800031 2 800032 2 80003...
output:
239953645 19493502 860332824 103642120 124735628 986668460 93666237 220001877 210025998 305292251 526894146 738520164 47168084 575662254 317538091 366306203 943568487 264462257 632368494 579292664 845354959 481079140 63727493 910682496 395117329 460444870 374483063 771200444 235001015 611084134 3856...
result:
ok 100000 numbers
Test #18:
score: 0
Accepted
time: 564ms
memory: 19312kb
input:
100000 700001 3 700002 3 700003 3 700004 3 700005 3 700006 3 700007 3 700008 3 700009 3 700010 3 700011 3 700012 3 700013 3 700014 3 700015 3 700016 3 700017 3 700018 3 700019 3 700020 3 700021 3 700022 3 700023 3 700024 3 700025 3 700026 3 700027 3 700028 3 700029 3 700030 3 700031 3 700032 3 70003...
output:
239077146 919422236 684295616 331672281 955347205 428100957 79405920 189512039 559793484 509966345 724266614 764640007 102113462 524843741 158698870 110210779 11799910 879076509 709212318 222030783 895688902 907053535 123358669 864713110 165256936 748562838 606036646 13231788 14470909 794822713 2984...
result:
ok 100000 numbers
Test #19:
score: 0
Accepted
time: 464ms
memory: 19216kb
input:
100000 800001 1 800002 1 800003 1 800004 1 800005 1 800006 1 800007 1 800008 1 800009 1 800010 1 800011 1 800012 1 800013 1 800014 1 800015 1 800016 1 800017 1 800018 1 800019 1 800020 1 800021 1 800022 1 800023 1 800024 1 800025 1 800026 1 800027 1 800028 1 800029 1 800030 1 800031 1 800032 1 80003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 472ms
memory: 19244kb
input:
100000 700001 1 700002 1 700003 1 700004 1 700005 1 700006 1 700007 1 700008 1 700009 1 700010 1 700011 1 700012 1 700013 1 700014 1 700015 1 700016 1 700017 1 700018 1 700019 1 700020 1 700021 1 700022 1 700023 1 700024 1 700025 1 700026 1 700027 1 700028 1 700029 1 700030 1 700031 1 700032 1 70003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #21:
score: 0
Accepted
time: 464ms
memory: 19168kb
input:
100000 300001 2 300002 2 300003 2 300004 2 300005 2 300006 2 300007 2 300008 2 300009 2 300010 2 300011 2 300012 2 300013 2 300014 2 300015 2 300016 2 300017 2 300018 2 300019 2 300020 2 300021 2 300022 2 300023 2 300024 2 300025 2 300026 2 300027 2 300028 2 300029 2 300030 2 300031 2 300032 2 30003...
output:
996839949 634447948 498003978 497199578 134003179 632607165 132162400 266765591 899972770 34490833 301856442 204184879 239275734 541732200 746517105 986392867 530480744 279353528 268102076 799182856 80892069 349594185 151132730 232624843 582819074 734551852 967776745 552951518 289859071 259991519 81...
result:
ok 100000 numbers
Test #22:
score: 0
Accepted
time: 475ms
memory: 19088kb
input:
100000 200001 1 200002 1 200003 1 200004 1 200005 1 200006 1 200007 1 200008 1 200009 1 200010 1 200011 1 200012 1 200013 1 200014 1 200015 1 200016 1 200017 1 200018 1 200019 1 200020 1 200021 1 200022 1 200023 1 200024 1 200025 1 200026 1 200027 1 200028 1 200029 1 200030 1 200031 1 200032 1 20003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #23:
score: 0
Accepted
time: 562ms
memory: 19228kb
input:
100000 400001 3 400002 3 400003 3 400004 3 400005 3 400006 3 400007 3 400008 3 400009 3 400010 3 400011 3 400012 3 400013 3 400014 3 400015 3 400016 3 400017 3 400018 3 400019 3 400020 3 400021 3 400022 3 400023 3 400024 3 400025 3 400026 3 400027 3 400028 3 400029 3 400030 3 400031 3 400032 3 40003...
output:
582417272 745523292 114510823 517935797 455301998 23982683 398125250 228310874 654763679 916804192 840688952 868605042 497254415 539310628 649556805 321608186 344744572 92002195 576239550 96460711 720363211 210585016 851035228 847391535 189533525 403368691 480941974 548555697 132043144 557292822 428...
result:
ok 100000 numbers
Test #24:
score: 0
Accepted
time: 464ms
memory: 19228kb
input:
100000 600001 1 600002 1 600003 1 600004 1 600005 1 600006 1 600007 1 600008 1 600009 1 600010 1 600011 1 600012 1 600013 1 600014 1 600015 1 600016 1 600017 1 600018 1 600019 1 600020 1 600021 1 600022 1 600023 1 600024 1 600025 1 600026 1 600027 1 600028 1 600029 1 600030 1 600031 1 600032 1 60003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #25:
score: 0
Accepted
time: 475ms
memory: 19244kb
input:
100000 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 3 17 3 18 3 19 3 20 3 21 3 22 3 23 3 24 3 25 3 26 3 27 3 28 3 29 3 30 3 31 3 32 3 33 3 34 3 35 3 36 3 37 3 38 3 39 3 40 3 41 3 42 3 43 3 44 3 45 3 46 3 47 3 48 3 49 3 50 3 51 3 52 3 53 3 54 3 55 3 56 3 57 3 58 3 59 3 60 3 61...
output:
1 2 6 24 72 180 428 1042 2512 5912 13592 30872 69560 155568 345282 761312 1669612 3645236 7927404 17180092 37119040 79986902 171964534 368959906 790214816 691535489 613680691 708478575 425344964 962285794 360692202 35914156 647650361 471059104 586254241 585096459 371146067 271628126 868408156 489876...
result:
ok 100000 numbers
Test #26:
score: 0
Accepted
time: 483ms
memory: 19188kb
input:
100000 500001 1 500002 1 500003 1 500004 1 500005 1 500006 1 500007 1 500008 1 500009 1 500010 1 500011 1 500012 1 500013 1 500014 1 500015 1 500016 1 500017 1 500018 1 500019 1 500020 1 500021 1 500022 1 500023 1 500024 1 500025 1 500026 1 500027 1 500028 1 500029 1 500030 1 500031 1 500032 1 50003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #27:
score: 0
Accepted
time: 461ms
memory: 19096kb
input:
100000 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
output:
1 2 6 12 20 34 56 88 136 208 314 470 700 1038 1534 2262 3330 4896 7192 10558 15492 22724 33324 48860 71630 105002 153912 225594 330650 484618 710270 1040980 1525660 2235994 3277040 4802768 7038832 10315944 15118786 22157694 32473716 47592582 69750358 102224158 149816826 219567272 321791520 471608438...
result:
ok 100000 numbers
Test #28:
score: 0
Accepted
time: 473ms
memory: 19220kb
input:
100000 400001 2 400002 2 400003 2 400004 2 400005 2 400006 2 400007 2 400008 2 400009 2 400010 2 400011 2 400012 2 400013 2 400014 2 400015 2 400016 2 400017 2 400018 2 400019 2 400020 2 400021 2 400022 2 400023 2 400024 2 400025 2 400026 2 400027 2 400028 2 400029 2 400030 2 400031 2 400032 2 40003...
output:
257191820 738553821 471348168 729339992 470449466 942597642 674493291 147498416 92651719 767945026 916243460 11450846 780195894 698995025 711245897 493997466 195548168 907594097 404147244 600495448 510645230 915592514 518643651 31844572 948237132 469436478 502081100 452873931 923110463 427747266 881...
result:
ok 100000 numbers
Test #29:
score: 0
Accepted
time: 464ms
memory: 19052kb
input:
100000 100001 1 100002 1 100003 1 100004 1 100005 1 100006 1 100007 1 100008 1 100009 1 100010 1 100011 1 100012 1 100013 1 100014 1 100015 1 100016 1 100017 1 100018 1 100019 1 100020 1 100021 1 100022 1 100023 1 100024 1 100025 1 100026 1 100027 1 100028 1 100029 1 100030 1 100031 1 100032 1 10003...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 numbers
Test #30:
score: 0
Accepted
time: 473ms
memory: 19048kb
input:
100000 300001 3 300002 3 300003 3 300004 3 300005 3 300006 3 300007 3 300008 3 300009 3 300010 3 300011 3 300012 3 300013 3 300014 3 300015 3 300016 3 300017 3 300018 3 300019 3 300020 3 300021 3 300022 3 300023 3 300024 3 300025 3 300026 3 300027 3 300028 3 300029 3 300030 3 300031 3 300032 3 30003...
output:
56435370 51650087 255988779 32915445 495668834 250070139 546951673 113629146 767379852 733798150 246058176 909129005 629872007 572612246 171787453 654392876 20047836 700663696 966630 893091079 781177119 639166443 950753391 855598861 259845225 33248030 216497360 418892080 370679409 237144018 63866723...
result:
ok 100000 numbers