QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290455 | #383. 蚯蚓排队 | MoRanSky | 100 ✓ | 645ms | 185800kb | C++20 | 2.0kb | 2023-12-25 00:37:22 | 2023-12-25 00:37:22 |
Judging History
answer
#include <iostream>
#include <cstdio>
using namespace std;
typedef unsigned long long ULL;
const int N = 2e5 + 5, S = 51, O = 1 << 23, T = 1e7 + 5, P = 998244353;
const ULL B = 7;
int n, m, L[N], R[N], a[N], p[N], pos[N];
ULL v[N][S], Pow[S];
char s[T];
int cnt[O];
int head[O], numE;
struct E{
int next, w;
ULL v;
} e[N * S * 2];
void inline add(ULL x, int k) {
int u = x % O;
for (int i = head[u]; i; i = e[i].next) {
if (e[i].v == x) {
e[i].w += k;
return ;
}
}
e[++numE] = (E) { head[u], k, x };
head[u] = numE;
}
int inline ask(ULL x) {
int u = x % O;
for (int i = head[u]; i; i = e[i].next) {
if (e[i].v == x) return e[i].w;
}
return 0;
}
void inline merge(int x, int y) {
R[x] = y, L[y] = x;
for (int i = x, j = 1; j <= 50 && i; j++, i = L[i]) {
while (p[i] < 50 && R[pos[i]]) {
pos[i] = R[pos[i]];
++p[i], v[i][p[i]] = v[i][p[i] - 1] * B + a[pos[i]];
add(v[i][p[i]], 1);
}
}
}
void inline split(int x) {
int y = R[x];
for (int i = x, j = 1; j <= 50 && i; j++, i = L[i]) {
while (pos[i] != x && pos[i] != i) {
add(v[i][p[i]], -1);
--p[i], pos[i] = L[pos[i]];
}
}
R[x] = 0, L[y] = 0;
}
int main() {
//freopen("C:/Users/MoRanSky/Downloads/P3823_3.in", "r", stdin);
Pow[0] = 1;
for (int i = 1; i < S; i++)
Pow[i] = Pow[i - 1] * B;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d", a + i), p[i] = 1, pos[i] = i;
v[i][1] = a[i], add(v[i][1], 1);
}
while (m--) {
int op; scanf("%d", &op);
if (op == 1) {
int x, y; scanf("%d%d", &x, &y);
merge(x, y);
} else if (op == 2) {
int x; scanf("%d", &x);
split(x);
} else {
int k; scanf("%s%d", s + 1, &k);
ULL val = 0;
int res = 1;
for (int i = 1; s[i]; i++) {
val = val * B + (s[i] - '0');
if (i - k >= 1) val = val - Pow[k] * (s[i - k] - '0');
if (i >= k) res = 1ll * res * ask(val) % P;
}
printf("%d\n", res);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 4
Accepted
time: 1ms
memory: 3596kb
input:
1 998 2 3 4 1 3 6 1 3 6 1 3 5 1 3 3 1 3 6 1 3 4 1 3 2 1 3 3 1 3 5 1 3 6 1 3 2 1 3 6 1 3 6 1 3 4 1 3 1 1 3 2 1 3 1 1 3 4 1 3 6 1 3 1 1 3 1 1 3 1 1 3 1 1 3 1 1 3 4 1 3 4 1 3 3 1 3 5 1 3 3 1 3 2 1 3 1 1 3 4 1 3 6 1 3 1 1 3 1 1 3 1 1 3 1 1 3 4 1 3 2 1 3 3 1 3 1 1 3 6 1 3 6 1 3 4 1 3 5 1 3 1 1 3 2 1 3 4 ...
output:
0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 998 lines
Test #2:
score: 4
Accepted
time: 1ms
memory: 3896kb
input:
20 36 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 15 1 20 8 1 6 13 1 12 14 1 8 16 1 18 10 1 15 20 1 11 5 1 3 18 1 2 12 1 10 19 1 5 3 1 9 4 1 4 1 1 16 2 1 14 17 1 17 11 1 7 6 1 13 9 3 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 9 3 21111111111...
output:
986314077 44443331 692899615 733474581 500292333 100000 74890016 217787087 725944917 725944917 580570788 224019031 982023376 958346178 492051342 721419738 26617260
result:
ok 17 lines
Test #3:
score: 4
Accepted
time: 4ms
memory: 8616kb
input:
150 2000 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 2 1 2 1...
output:
1 1369 59319 111149056 579076096 75497441 696218117 0 138412032 4096 49664
result:
ok 11 lines
Test #4:
score: 4
Accepted
time: 0ms
memory: 13588kb
input:
500 508 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 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 ...
output:
62 86 103 111 11449 1 7301384 170275611 251731360 15232
result:
ok 10 lines
Test #5:
score: 4
Accepted
time: 12ms
memory: 16472kb
input:
1000 2000 1 1 1 1 1 1 1 2 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 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 ...
output:
75497471 557842400 7776 488304148 20914171 382533613 813694974 977736708 788660220 522665847 646770514 697001913
result:
ok 12 lines
Test #6:
score: 4
Accepted
time: 89ms
memory: 76456kb
input:
50000 52913 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 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 2 1 1 3 1 2 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 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1 1 1 1 ...
output:
100663294 52953600 3350906 229765322 887621869 940273577 556568575 77125694 828 666008243 367790545 411163649 633970710 763354829 130586370 3360000 715174225 448852005 533570000 1349190 221848871 15240960 10125 133382700 88491522 37260000 477652581 319871250 33944064 778196802 735766300 611140495 39...
result:
ok 1089 lines
Test #7:
score: 4
Accepted
time: 44ms
memory: 24804kb
input:
50000 50367 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 ...
output:
73850210 335399794 177349861 530147760 679864040 408420629 977110945 266797286 731604775 908330181 195026826 107628602 517966089 543605781 713618257 872105513 462825074 272044043 792449213 633863169 626814262 299821169 345000831 61315514 177692186 274156588 341079525 388184505 244861282 598888666 40...
result:
ok 450 lines
Test #8:
score: 4
Accepted
time: 49ms
memory: 73696kb
input:
50000 50451 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 2 1 1 1 1 2 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 2 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 ...
output:
3564288 1 1 1 1 2880 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2048 1 128 387325950 1 811745279 124 40 1 72 80 1125000 288 4 2 2457600 1 1 1 8 4 0 6 1 1 1 1 1 1 16512 933120 1 7962624 1 1 12 1 1 1 1 1 1 19200 1 9 1 3456 1327104 9 1 1 1 384 1 219240 1 1 1 536870692 1 1 1119744 1 1 16 1 1 2592000 4590432 905887742 ...
result:
ok 498 lines
Test #9:
score: 4
Accepted
time: 80ms
memory: 77680kb
input:
50000 52353 1 1 1 1 1 1 1 1 1 1 2 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 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 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 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 3 ...
output:
1 1 1 1 1 12 1866240 0 1 1 32 32 119439360 182878207 1 108000 1 1 1 1 1 1 1 1 704642628 1 432 1 55296 54675 1 1 15129 66528 703624188 768 0 1 1959552 64 1 96 2 1 1 196608 845091137 1 1 64 1 1 1 1 1 224 1 972 579862517 1 4 1 96 737280 16 270978048 1 0 4 1 1 1 3888 1 46656 18 20 16 1 1 1280 1 1 1 2048...
result:
ok 488 lines
Test #10:
score: 4
Accepted
time: 124ms
memory: 74648kb
input:
50000 72349 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 ...
output:
1 1 11 1 1 1 1 12 1 1 12057136 1 722677759 1 1 926449744 1 5270 485529040 1 4 216 1 1 1 336 1 1 1 1 1 1 4 1 1 1 18000640 1 1 388 4 1 1 1 1 1 256 32845824 1 850208 1 1 2 404458118 1 8 1 1 1 1 1 1 1 4608 2 37748736 1536 1 1 256 1 128 1 18 134369280 1 1 1 1 1 1 131072 1 5 2304 4 1024 39 432 29196288 1 ...
result:
ok 22350 lines
Test #11:
score: 4
Accepted
time: 161ms
memory: 82592kb
input:
50000 74648 1 1 1 1 1 1 1 2 1 1 1 2 3 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 2 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 1 ...
output:
2 1 1 1 1 1 1 828609048 1 94089600 1 16 3 1 6962 1 1 1 4 768 2 1 4 86016 2 1 4480 1 1 1 79626240 1 1 1 1 1 1 1 32 1 1210104 1 1 1 1 1 1 82944 128 870912 96 1 640 1 3 38338560 1 1 4 8 1 1 1 724565999 1 1 139747327 5598720 233046014 1 55427328 1 27648 216 64 36000 316155013 1 1 1 1 1 1 974848 12672 17...
result:
ok 22654 lines
Test #12:
score: 4
Accepted
time: 111ms
memory: 99796kb
input:
100000 102412 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 3 1 1 1 1 1 3 1 1 1 1 4 1 1 1 1 1 2 1 1 1 1 1 2 1 3 1 1 1 1 1 2 1 1 1 2 1 1 1 1 2 1 1 1 ...
output:
640458633 60963840 897933587 628097584 722400 418906108 982543771 300008345 996497641 865276065 302221656 40365 900843246 853893119 31214995 831911896 924 2151 16685460 406508583 656801788 454150925 834562506 486999764 260494588 605515982 953400199 52140 7530240 489126 74018880 712685373 563372007 6...
result:
ok 1834 lines
Test #13:
score: 4
Accepted
time: 82ms
memory: 45884kb
input:
100000 100656 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 ...
output:
198290936 992475757 405123071 964895911 71655934 628083161 956765929 18403623 985924788 239349881 404782937 623344687 691801117 212980600 855727768 238671922 506003980 120143114 961389211 638804306 353001491 476016952 374730674 483348327 231068352 933469750 134888160 860558795 462702394 901108431 85...
result:
ok 919 lines
Test #14:
score: 4
Accepted
time: 116ms
memory: 107896kb
input:
100000 100808 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 2 1 1 1 ...
output:
1 1 1 2002 24576 1 16 9072 1 58719409 1 1 32 4 201553920 32 5760 16 1 1 192 1 1 1 1 1 1 1 27648 1 244687500 1 1 17 1 32 252887040 1 1 1 12 5660 16 1 2 648 7 1 182020608 2 7526400 1 1 1 1 1 18 1 1 1 881795200 4608 1 10450944 848 4224 1 1 1 1 1 1 1 16 5971968 3 1 486202500 1 1 71385600 1 1 1 1 4 13271...
result:
ok 989 lines
Test #15:
score: 4
Accepted
time: 150ms
memory: 110460kb
input:
100000 102784 1 1 1 2 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 6 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 3 1 1 3 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 3 1 1 2 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 1 1 1 2 1 3 1 1 1 ...
output:
1 1 1 1 64 8 1 1 1 1 1 1 1 1 1 1 20528640 256 1 1 1 1 1 1 4788 8 1 282920935 1 1 1 1 1 6 16 1 1 1 1 1 1 1 2 4608 1 1 1 16 3969 1 216 1 689962967 1 1 1 1 1 1 1 24 18 1 124416 1 160380000 126 2 1 1 1 896000 921600 96 0 396477100 641520 12 1 1 128 1024 4 312552757 1 1 1 8 3456 1 9 1 1 1 1 1 1 723384316...
result:
ok 1017 lines
Test #16:
score: 4
Accepted
time: 247ms
memory: 110204kb
input:
100000 144773 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1 1 1 512 1 1 1 707788800 1 1 65664 1458 1 12 1 1 5591040 1 1 1 135780823 1 1 18 5603328 1 729 209952 1 1 1 176359680 576 256 1 2 1 1 1 1 1 1 6750 1 1 2592 1 90699264 1 1 1 8 1 1 1 128000 2939328 16 1 1 1 1 1 10752000 32 1 128 24 174960 1 49152 196608 5184 1 1 1 949453982 0 663552 161480699 1 0 1 46...
result:
ok 44774 lines
Test #17:
score: 4
Accepted
time: 303ms
memory: 117344kb
input:
100000 147055 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 ...
output:
1 1 6144 156826282 1 1 1399680 6 960 1 654310356 462 1 116 1 1 1 1 1 36 1 1 10077696 31104 178 58786517 1 9261 64 57600 1 1 1 1 1 1 1 1 1 1 1 7 6553600 1 1 1 1 2 1 6 1 1 621 6144 9129120 1 1 1 3520 2 1 810 4 91402195 1 6553600 1 8064 1 4 48 1 1 884736000 43740 1 327680 262144 1 318504960 120932352 8...
result:
ok 45065 lines
Test #18:
score: 4
Accepted
time: 425ms
memory: 178420kb
input:
200000 399780 1 3 3 1 1 1 1 1 1 1 3 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 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 3 2 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 2 3 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 ...
output:
965545644 517982843 811335593 206826568 316282367 25769427 990412672 851334466 734320572 835132994 682948162 241464885 678696149 653734751 130654691 135078617 44817012 12459586 677166287 73790001 506138083 432849544 262906691 31612387 56822326 227256386 828790982 401372203 293848612 704938609 130429...
result:
ok 199781 lines
Test #19:
score: 4
Accepted
time: 424ms
memory: 184616kb
input:
200000 401819 1 1 1 1 1 1 1 2 1 1 1 2 1 1 2 2 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 2 1 1 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 2 1 1 1 1 1 ...
output:
130116983 977674623 374790962 256046139 132779421 101017502 837226439 633310464 22039359 358766271 982950410 663054881 223626954 928022291 132771200 520138402 193069461 635524060 851110046 938145942 339111862 477458229 875301563 733336778 330150311 645636343 594675245 482804857 260698992 533011020 2...
result:
ok 199864 lines
Test #20:
score: 4
Accepted
time: 159ms
memory: 134592kb
input:
200000 197059 1 1 1 1 1 1 1 2 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 ...
output:
54516 244953 46233460 128801250 134400 719940 685737104 21384 750639403 464045609 29750 959200355 173352960 39936 227749635 655537152 726856 242611200 4533256 1116 398597718 659570749 91661774 573395515 887046141 27904 791688374 83698941 35704800 96682689 397539053 51817713 505852800 812207381 23057...
result:
ok 3981 lines
Test #21:
score: 4
Accepted
time: 197ms
memory: 87424kb
input:
200000 201065 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 ...
output:
80053730 332102092 932233665 209628971 444572055 852281705 797328387 653295229 586033964 933138118 663205669 801373881 918412965 222472001 292879203 11759307 295061778 463499204 662575122 262664612 620722766 947907440 118602298 76664217 338857529 406009104 829198833 888783427 643654271 606259692 848...
result:
ok 1822 lines
Test #22:
score: 4
Accepted
time: 299ms
memory: 174832kb
input:
200000 201611 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 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 4 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 ...
output:
1 1 11520000 121569278 1 1 362880 1 1 45554400 463704 16 1 1 1 215221492 1 1 1 1 13824 1 1 1 1 279936 144 4 7303448 256 4 32 286654464 4 1 311040 1 1 1 1 1 1280 1 1451520 288 1 1 1 313600 1 1024 1 0 1 1 27000 73920 124178832 1 45416448 256 1 840 1 5 4 1 1 2 2 1 3194640 1 1 1 500 343932863 8 1 1 32 2...
result:
ok 2041 lines
Test #23:
score: 4
Accepted
time: 319ms
memory: 175936kb
input:
200000 203548 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 2 1 1 1 1 1 ...
output:
792 1 1 1 1 1 1 2 1 1 1 1 18432 64 2 82944 1 1 1 1 1 1 1 13899600 995328 1 1 2916 128 1 9216 1 1 4096 1 34560 1 1 15360 1 1 972549866 0 1161216 829947506 444923119 984960 1 95760 1 33554432 1 768 1 1 42467328 7 1 1 1 1 311 2 1 1 42120 1 1 1 1 559872 395278570 1 31744 20 1 1 19200 1 1 1 1370880 8 1 1...
result:
ok 2055 lines
Test #24:
score: 4
Accepted
time: 560ms
memory: 179368kb
input:
200000 289562 1 1 1 1 2 1 1 2 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 2 1 1 1 1 2 1 1 1 1 3 1 1 4 1 1 1 1 1 2 3 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 4 1 1 ...
output:
384 2 1 4 1 16 1 1 6 768 1 1 1 1 1 1440000 1 16 1 1 1 64512 243 2 256 1 64 40 1 108 1 1 1 1064448 1 1 1 168000000 540 1 864 4 1 1 8 1 45619200 8 1 1 4 698777413 1 1 40 1 1 1 377487360 1 1 2548520 1 1 3840 570006972 1 1 3064 1 1 27 73656 3 662961789 96 295372210 896547420 352321179 1 41472 24 14 1 85...
result:
ok 89563 lines
Test #25:
score: 4
Accepted
time: 645ms
memory: 185800kb
input:
200000 291554 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 3 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 2 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 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 2 ...
output:
1 1 1 2 1 452391422 32 1 1 1 1 1 8 186624 1 1 183140352 1 1 62099136 1 4 1 1 402408 5308416 1 1 1 1 432 1 512 1 1 1 1 1 8 1 1 1 990115959 1 1 1 1 234880381 76800 1 486 55296 1 16 1 1 1 1680 42758116 1 33524 1 1 2 332398588 1 24 1 576 1 2880 1 1 1 1 1 954895749 4600 562036729 1 1 1 1 589824 1 7201584...
result:
ok 89571 lines
Extra Test:
score: 0
Extra Test Passed