QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290612 | #4946. 青蕈领主 | MoRanSky | 100 ✓ | 158ms | 18976kb | C++23 | 4.2kb | 2023-12-25 06:05:52 | 2023-12-25 06:05:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long LL;
typedef pair<int, int> PII;
template <typename T> void inline read(T &x) {
x = 0; int f = 1; char s = getchar();
while (s < '0' || s > '9') { if (s == '-') { f = -1; } s = getchar(); }
while (s >= '0' && s <= '9') x = x * 10 + (s ^ 48), s = getchar();
x *= f;
}
template <typename T> bool inline chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }
template <typename T> bool inline chkMin(T &x, T y) { return y < x ? x = y, 1 : 0; }
const int N = 150005, P = 998244353, G = 3;
int T, n, f[N], a[N], top;
PII s[N];
void inline add(int &x, int y) {
x += y;
if (x >= P) x -= P;
}
typedef vector<int> Poly;
#define pb push_back
int A[N], rev[N], mod, inv[N];
int lim = 1, len = 0, W[18][N];
int inline power(int a, int b, int Mod = P) {
int res = 1;
while (b) {
if (b & 1) res = (LL)res * a % Mod;
a = (LL)a * a % Mod;
b >>= 1;
}
return res;
}
int Gi = power(G, P - 2, P), inv2 = power(2, P - 2, P);
void inline NTT(int c[], int lim, int o) {
for (int i = 0; i < lim; i++)
if (i < rev[i]) swap(c[i], c[rev[i]]);
for (int k = 1, t = 0; k < lim; k <<= 1, t++) {
for (int i = 0; i < lim; i += (k << 1)) {
for (int j = 0; j < k; j++) {
int u = c[i + j], v = (LL)c[i + k + j] * W[t][j] % P;
c[i + j] = u + v >= P ? u + v - P : u + v;
c[i + j + k] = u - v < 0 ? u - v + P : u - v;
}
}
}
if (o == -1) {
reverse(c + 1, c + lim);
int inv = power(lim, P - 2, P);
for (int i = 0; i < lim; i++)
c[i] = (LL)c[i] * inv % P;
}
}
void inline setN(int n) {
lim = 1, len = 0;
while (lim < n) lim <<= 1, len++;
for (int i = 0; i < lim; i++)
rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (len - 1));
}
Poly inline NTT(Poly a, int o) {
int n = a.size();
for (int i = 0; i < n; i++) A[i] = a[i];
NTT(A, lim, o);
a.clear();
for (int i = 0; i < lim; i++) a.push_back(A[i]), A[i] = 0;
return a;
}
Poly operator + (const Poly a, const Poly b) {
Poly c(max(a.size(), b.size()));
for (int i = 0; i < c.size(); i++) {
if (i < a.size()) {
c[i] += a[i]; if (c[i] >= P) c[i] -= P;
}
if (i < b.size()) {
c[i] += b[i]; if (c[i] >= P) c[i] -= P;
}
}
return c;
}
Poly inline mul (Poly a, Poly b, int newn = -1) {
if (newn == -1) newn = a.size() + b.size() - 1;
setN(a.size() + b.size() - 1);
Poly c = NTT(a, 1), d = NTT(b, 1);
for (int i = 0; i < lim; i++) c[i] = (LL)c[i] * d[i] % P;
d = NTT(c, -1); d.resize(newn);
return d;
}
// 鐢ㄥ埌鐨勬渶澶х殑 n
void inline init(int n) {
setN(2 * n);
for (int k = 1, t = 0; k < lim; k <<= 1, t++) {
int wn = power(G, (P - 1) / (k << 1));
W[t][0] = 1;
for (int j = 1; j < k; j++) W[t][j] = (LL)W[t][j - 1] * wn % P;
}
}
void inline del(int &x, int y) {
x -= y;
if (x < 0) x += P;
}
void solve(int l, int r) {
if (l == r) {
if (r > 1) {
if (r % 2 == 0) del(f[r], 1ll * f[r / 2] * f[r / 2] % P);
f[r] = 1ll * f[r] * (r - 2) % P * inv2 % P;
if (r % 2 == 0) add(f[r], 1ll * f[r / 2] * f[r / 2] % P * (r / 2 - 1) % P);
del(f[r], 1ll * f[1] * (r - 2) % P * f[r - 1] % P);
add(f[r], 1ll * f[r - 1] * (r - 1) % P);
}
return;
}
int mid = (l + r) >> 1;
solve(l, mid);
// calc F * F -> F
Poly A, B;
for (int i = l; i <= mid; i++) A.pb(f[i]);
B.pb(0);
for (int i = 1; i <= min(r - l, mid); i++) {
int w = f[i];
if (i < l) w = w * 2 % P;
B.pb(w);
}
A = mul(A, B);
for (int i = mid + 1; i <= r; i++) {
int p = i - l;
if (p < A.size()) add(f[i], A[p]);
}
solve(mid + 1, r);
}
void inline prework() {
f[0] = 1;
f[1] = 2;
solve(1, n);
}
void inline work() {
if (a[n] != n) {
puts("0");
return;
}
top = 0;
int ans = 1;
for (int i = 1; i <= n; i++) {
int c = 0;
int L = i - a[i] + 1;
while (top && s[top].se >= L) {
if (s[top].fi < L) {
puts("0");
return;
}
c++;
top--;
}
ans = 1ll * ans * f[c] % P;
s[++top] = mp(L, i);
}
printf("%d\n", ans);
}
int main() {
read(T), read(n); init(n);
prework();
while (T--) {
for (int i = 1; i <= n; i++) read(a[i]);
work();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 9816kb
input:
1 10 1 1 3 1 2 1 4 1 2 10
output:
64
result:
ok 1 number(s): "64"
Test #2:
score: 5
Accepted
time: 0ms
memory: 9728kb
input:
1 10 1 1 3 1 2 1 2 7 9 10
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 5
Accepted
time: 1ms
memory: 10160kb
input:
100 10 1 2 1 2 1 1 1 1 5 10 1 1 1 1 1 1 1 1 9 10 1 2 1 1 1 1 1 8 1 10 1 1 1 1 1 1 2 1 1 10 1 1 2 4 1 1 1 1 5 10 1 1 3 1 1 1 1 1 9 10 1 1 3 1 2 1 2 1 4 10 1 1 1 1 1 3 1 8 1 10 1 1 1 1 1 1 1 1 3 10 1 1 3 1 1 1 2 3 1 10 1 1 1 1 1 1 6 1 2 10 1 1 1 3 1 1 1 1 5 10 1 1 3 1 5 1 1 1 9 10 1 1 1 4 1 1 1 1 5 10...
output:
256 87360 2400 87360 128 2400 64 352 9600 704 704 128 128 128 2400 128 2400 2400 2400 64 128 1408 128 9600 443296 128 128 9600 9600 443296 0 443296 256 2400 0 64 87360 443296 443296 128 0 443296 0 256 443296 443296 1408 9600 128 443296 704 443296 0 443296 2400 704 443296 87360 2400 704 443296 87360 ...
result:
ok 100 numbers
Test #4:
score: 5
Accepted
time: 1ms
memory: 9932kb
input:
100 10 1 1 1 1 1 1 7 1 2 10 1 1 1 1 1 6 1 1 3 10 1 1 1 1 1 1 1 3 1 10 1 2 1 2 1 1 3 1 1 10 1 1 1 1 5 1 7 1 1 10 1 1 1 1 1 2 1 1 1 10 1 2 1 1 1 4 1 1 3 10 1 1 1 1 1 2 1 8 1 10 1 1 1 1 5 1 1 1 2 10 1 1 1 2 1 1 1 1 8 10 1 1 1 1 5 1 1 1 6 10 1 1 1 1 1 5 1 8 1 10 1 2 1 2 1 2 1 1 3 10 1 1 1 1 1 1 1 1 1 10...
output:
2400 352 9600 704 128 87360 64 2400 512 2400 0 128 256 443296 9600 2400 87360 0 443296 87360 87360 1408 64 2400 64 443296 256 64 128 352 443296 0 443296 128 0 0 704 443296 704 443296 9600 128 2400 9600 87360 352 128 443296 128 704 0 1408 128 9600 443296 704 2400 2400 443296 0 128 2400 443296 9600 35...
result:
ok 100 numbers
Test #5:
score: 5
Accepted
time: 2ms
memory: 13956kb
input:
1 300 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 100 10...
output:
731696071
result:
ok 1 number(s): "731696071"
Test #6:
score: 5
Accepted
time: 1ms
memory: 11884kb
input:
1 300 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
654818711
result:
ok 1 number(s): "654818711"
Test #7:
score: 5
Accepted
time: 0ms
memory: 13984kb
input:
100 300 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 25 1 1 1 1 1 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 8 1 1 17 1...
output:
629582282 936488602 14854846 0 972850406 335643474 401801367 518359524 0 42431632 964390278 0 735641393 402072933 0 315498454 714104802 235533741 71997442 584545233 143385672 0 243017113 986234659 955040013 187506887 47264449 0 134183782 140053056 645326653 706116063 793388530 755635337 660249932 35...
result:
ok 100 numbers
Test #8:
score: 5
Accepted
time: 0ms
memory: 11976kb
input:
100 300 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 16 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 46 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 13 1 1 1 1 21 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 12 1 40 1 1 1 1 1 1 1 1 1 1 ...
output:
213721346 242599023 719011592 0 422638207 728716801 710719728 177328520 0 443663955 995539661 0 0 0 582405109 301065834 482480764 189294107 882417753 263472408 583100647 887062292 558090353 374255923 176488287 958825157 132492749 27789769 297287037 0 0 2733249 643517198 0 20415575 953067857 74118762...
result:
ok 100 numbers
Test #9:
score: 5
Accepted
time: 2ms
memory: 14304kb
input:
1 997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
495842312
result:
ok 1 number(s): "495842312"
Test #10:
score: 5
Accepted
time: 4ms
memory: 14012kb
input:
100 1000 1 1 1 2 4 1 6 1 2 3 11 1 1 2 1 4 1 1 1 2 5 1 11 1 1 2 3 1 18 1 2 1 1 1 6 1 1 2 4 5 1 1 3 9 1 1 2 1 5 1 7 1 2 1 1 2 1 4 24 1 1 1 1 3 1 1 7 1 2 1 2 61 1 2 3 1 2 1 4 8 9 82 1 2 3 1 1 6 1 2 9 1 1 3 1 5 1 1 8 1 1 3 1 1 23 1 2 1 4 1 1 7 1 2 3 4 1 2 1 8 1 2 1 12 1 1 2 1 1 2 1 1 3 4 8 1 2 3 15 1 1 ...
output:
639441690 325951010 772826730 707904063 750757689 685150437 3586144 711874830 882896695 312252618 0 0 625591512 0 0 953293767 310960913 665863278 61999458 536746177 269479775 755348118 0 816896717 0 0 0 890648230 0 435292445 0 528885058 277580975 916252312 0 958726742 640472413 682980893 661293405 0...
result:
ok 100 numbers
Test #11:
score: 5
Accepted
time: 3ms
memory: 14352kb
input:
100 1000 1 1 1 2 3 1 1 3 1 2 6 1 1 12 1 1 3 4 1 2 1 1 1 3 4 1 9 1 1 29 1 2 1 4 1 2 1 1 1 1 3 5 7 1 1 1 3 1 2 16 1 2 1 4 1 1 2 3 1 2 6 8 9 1 1 16 1 1 3 40 1 2 3 74 1 1 1 2 1 2 1 4 1 1 11 1 2 3 1 2 6 1 2 3 4 1 1 3 1 9 10 1 2 3 4 1 1 1 2 3 5 1 2 1 1 11 1 2 1 2 5 1 7 8 34 1 2 37 1 2 1 1 1 49 1 1 1 2 4 6...
output:
0 0 706651534 439786013 0 70411622 0 0 0 835773719 0 0 0 107157784 27212808 568144383 407628078 308471256 890881779 0 0 0 0 389644399 0 452029310 55646018 0 183690719 0 0 0 0 609100480 611850278 81354283 0 89798335 375537513 0 902011601 957022140 0 903873199 0 276820482 0 247728618 866180585 4914605...
result:
ok 100 numbers
Test #12:
score: 5
Accepted
time: 5ms
memory: 14088kb
input:
100 1000 1 1 1 2 3 1 1 3 1 2 6 1 1 12 1 1 3 4 1 2 1 1 1 3 4 1 9 1 1 29 1 2 1 4 1 2 1 1 1 1 3 5 7 1 1 1 3 1 2 16 1 2 1 4 1 1 2 3 1 2 6 8 9 1 1 16 1 1 3 40 1 2 3 74 1 1 1 2 1 2 1 4 1 1 11 1 2 3 1 2 6 1 2 3 4 1 1 3 1 9 10 1 2 3 4 1 1 1 2 3 5 1 2 1 1 11 1 2 1 2 5 1 7 8 34 1 2 37 1 2 1 1 1 49 1 1 1 2 4 6...
output:
0 0 706651534 439786013 0 70411622 0 0 0 835773719 0 0 0 107157784 27212808 568144383 407628078 308471256 890881779 0 0 0 0 389644399 0 452029310 55646018 0 183690719 0 0 0 0 609100480 611850278 81354283 0 89798335 375537513 0 902011601 957022140 0 903873199 0 276820482 0 247728618 866180585 4914605...
result:
ok 100 numbers
Test #13:
score: 5
Accepted
time: 14ms
memory: 14132kb
input:
100 5000 1 1 1 2 4 1 1 7 1 1 3 1 2 1 2 1 9 1 2 1 2 1 6 1 17 1 19 1 1 1 2 1 1 1 1 7 1 1 1 39 1 1 1 2 1 2 1 6 48 1 1 51 1 1 2 1 4 5 1 2 1 1 1 6 1 13 1 1 2 1 4 1 1 3 1 10 1 1 3 1 15 1 2 1 2 3 1 1 36 1 1 1 2 3 1 1 1 7 1 1 2 1 4 1 1 1 1 10 1 20 1 2 1 1 3 1 1 66 1 1 1 2 3 1 1 1 2 4 1 1 1 1 5 1 17 1 1 1 4 ...
output:
0 292588696 344051249 351335346 0 985560804 0 0 744141033 0 318360253 509056631 897631526 210708530 0 282499786 0 0 298272534 0 866815275 708474811 0 0 533348880 0 0 0 496288915 0 288732736 613115755 275961405 582960568 0 777792174 304810404 835564816 0 809847872 0 0 890711747 27774048 0 838137435 8...
result:
ok 100 numbers
Test #14:
score: 5
Accepted
time: 11ms
memory: 14120kb
input:
100 5000 1 1 2 3 1 5 1 1 1 1 3 1 2 1 9 1 1 1 2 3 1 21 1 1 3 1 5 6 1 2 3 4 1 1 2 4 36 38 1 1 1 1 2 4 1 1 3 1 9 1 11 1 1 1 1 1 2 1 20 1 2 1 24 1 1 1 1 2 3 31 1 33 1 2 1 4 1 2 7 1 1 2 4 12 1 2 3 4 1 1 7 8 1 10 1 1 13 1 2 1 4 1 19 1 2 1 4 5 1 7 1 2 3 1 2 1 2 1 6 1 2 3 20 1 1 2 3 1 2 1 2 1 1 3 135 1 1 1 ...
output:
153322044 150492767 0 994490869 0 0 0 855074869 0 788845897 849135324 558695774 329454393 0 0 0 739924836 452723945 0 786225052 0 0 0 185397693 73624630 988094148 0 836735505 57947855 705987810 106069205 0 0 885756183 494461680 182794483 0 482961814 31686100 0 0 249571642 543812012 0 722599260 64625...
result:
ok 100 numbers
Test #15:
score: 5
Accepted
time: 7ms
memory: 16148kb
input:
100 5000 1 1 1 2 1 2 6 1 1 2 10 1 1 1 2 1 6 1 8 1 1 3 1 2 1 2 1 1 1 1 12 1 2 3 1 1 3 1 1 2 1 11 1 2 3 4 5 6 1 19 1 1 3 1 1 2 3 1 2 3 4 8 1 1 11 1 1 1 68 1 2 3 4 5 1 75 1 2 1 2 1 2 1 8 1 2 3 1 1 2 15 1 2 1 4 96 1 1 3 1 2 1 7 1 9 106 1 2 1 1 1 1 7 1 2 1 1 2 1 1 6 1 8 1 12 1 1 2 1 5 1 2 3 1 2 1 2 1 2 1...
output:
946701850 983965823 543510180 0 234696913 532101369 36100829 817231065 772588292 709229991 29442326 651065274 0 837031094 0 0 316959187 97361210 0 989103922 345758410 347379164 0 897533810 488460689 0 0 497682855 33909352 194898623 0 0 118515226 0 284902892 251441025 850822408 357498752 892873025 0 ...
result:
ok 100 numbers
Test #16:
score: 5
Accepted
time: 14ms
memory: 14100kb
input:
100 5000 1 1 1 3 4 1 1 2 3 1 1 6 1 8 14 1 1 2 3 1 2 3 1 1 1 4 8 1 2 3 1 17 1 19 1 2 3 1 2 1 2 1 6 1 2 1 46 1 1 1 1 1 4 1 2 1 4 9 1 1 2 15 1 1 3 4 5 1 2 1 4 71 1 1 3 1 5 78 1 2 3 1 2 6 1 1 2 1 1 1 4 1 8 9 1 1 2 1 2 3 1 1 9 1 1 22 1 1 2 1 5 1 29 1 2 1 4 5 41 1 2 1 1 5 1 1 1 2 1 1 1 1 5 8 1 1 3 4 1 1 6...
output:
0 0 0 387445433 53260884 0 253952014 537163051 36559794 0 511384985 0 832504854 740181150 330078867 405525929 569684673 0 0 827053910 613985912 647990716 75829151 918618470 295766219 845315492 0 0 129206830 666746707 586695222 81186019 0 35517922 0 392622181 0 722722877 685721668 0 788434307 7688927...
result:
ok 100 numbers
Test #17:
score: 5
Accepted
time: 158ms
memory: 18860kb
input:
100 50000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 5 1 22 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
938322083 0 627807333 0 553973202 0 0 14048401 0 950421047 0 622576077 0 744029553 793127481 645301924 533609841 852154523 625396972 62789084 413008358 292040298 656049825 581436181 922659811 0 0 0 91815535 506836479 156002945 205212058 316354153 344645416 521003850 532634702 926445048 641763410 519...
result:
ok 100 numbers
Test #18:
score: 5
Accepted
time: 156ms
memory: 18976kb
input:
100 50000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 6 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 9 1 32 1 1 1 1 2 1 1 1 1 1 1 1 1 1 3 1 1 65 1 1 1 1 1 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:
624885832 833309143 968068549 16720417 467661900 0 983405586 43591434 547668905 950286049 530347421 0 0 909087345 658815045 0 794306626 14976636 357941460 150818230 715847749 638450467 0 0 155568509 0 879137806 428155583 300267776 779360110 39013493 751776921 685994614 809532425 0 0 28163073 6789027...
result:
ok 100 numbers
Test #19:
score: 5
Accepted
time: 149ms
memory: 17272kb
input:
100 50000 1 1 2 3 1 5 1 1 1 3 5 1 2 14 15 1 2 1 1 2 1 1 1 3 4 1 10 11 14 15 1 2 3 1 20 1 2 3 1 1 2 4 1 2 10 1 1 3 4 1 2 1 4 5 1 7 1 2 10 1 1 1 1 2 1 2 6 1 1 3 1 5 1 1 8 15 1 2 34 1 1 1 2 1 1 2 3 1 2 7 1 1 2 4 1 1 97 1 99 1 1 1 1 2 6 7 1 1 1 1 3 5 6 1 1 2 11 1 2 1 15 1 1 124 1 1 1 2 5 1 2 8 9 1 1 1 3...
output:
475040820 821423600 161407909 880735181 500071559 337741049 134440032 894840892 976405119 528519244 473904119 936942481 875766540 93375618 980295619 621222155 0 393457466 0 0 281655372 418588257 269174342 31667135 0 0 462648500 0 528191112 831811998 548436806 0 0 917468062 373787292 425247061 235798...
result:
ok 100 numbers
Test #20:
score: 5
Accepted
time: 158ms
memory: 17280kb
input:
100 50000 1 1 1 1 1 3 1 1 6 1 1 1 10 1 12 1 1 1 4 1 2 1 4 1 2 3 1 1 2 3 5 1 18 1 2 3 1 1 1 1 1 2 1 2 1 10 1 2 1 1 1 16 1 2 3 23 1 2 3 1 5 1 2 1 1 5 6 1 2 3 1 11 1 1 1 4 1 2 1 2 3 1 5 1 9 1 11 1 1 1 3 1 2 79 1 1 2 3 4 1 1 1 2 5 1 2 3 1 5 15 17 1 1 1 1 1 1 2 5 1 27 1 29 1 2 1 2 3 1 7 8 1 2 3 1 133 1 2...
output:
0 0 682944657 750632782 263950446 693440161 405059290 525305126 44971279 123548737 0 741272096 576480062 0 677196555 0 145863649 0 0 0 987541820 0 714088381 470820324 0 893509858 0 0 258145392 0 374442624 393753011 495298252 455139328 0 454995497 462625493 552202545 35811919 51255305 465265116 94156...
result:
ok 100 numbers
Extra Test:
score: 0
Extra Test Passed