QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#313943 | #7648. 网格图最大流计数 | alpha1022 | 100 ✓ | 854ms | 24280kb | C++14 | 7.4kb | 2024-01-25 10:36:58 | 2024-01-25 10:36:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
int neg(int x) { return x ? mod - x : 0; }
int quo2(int x) { return (x + (x & 1 ? mod : 0)) >> 1; }
void add(int &x, int y) { if ((x += y - mod) < 0) x += mod; }
void sub(int &x, int y) { if ((x -= y) < 0) x += mod; }
int mpow(int a, int b) {
int ret = 1;
for (; b; b >>= 1) {
if (b & 1) ret = (ll)ret * a % mod;
a = (ll)a * a % mod;
}
return ret;
}
namespace Matrix {
const int D = 2;
const int N = 804;
template<class T>
vector<int> charPoly(int n, T mat) {
static int a[N + 5][N + 5], poly[N + 5][N + 5];
for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = neg(mat[i][j]);
for (int i = 1; i < n; ++i) {
int pivot = i + 1;
for (; pivot <= n && !a[pivot][i]; ++pivot);
if (pivot > n) continue;
if (pivot > i + 1) {
for (int j = i; j <= n; ++j) swap(a[i + 1][j], a[pivot][j]);
for (int j = 1; j <= n; ++j) swap(a[j][i + 1], a[j][pivot]);
}
int nv = mpow(a[i + 1][i], mod - 2);
for (int j = i + 2; j <= n; ++j)
if (a[j][i]) {
int t = (ll)a[j][i] * nv % mod;
for (int k = i; k <= n; ++k) a[j][k] = (a[j][k] + (ll)(mod - t) * a[i + 1][k]) % mod;
for (int k = 1; k <= n; ++k) a[k][i + 1] = (a[k][i + 1] + (ll)t * a[k][j]) % mod;
}
}
poly[n + 1][0] = 1;
for (int i = n; i; --i) {
poly[i][0] = 0;
for (int j = 1; j <= n + 1 - i; ++j) poly[i][j] = poly[i + 1][j - 1];
for (int j = i, t = 1; j <= n && t; t = (ll)t * a[j + 1][j] % mod, ++j) {
int coe = (ll)t * a[i][j] % mod;
if (!coe) continue;
if ((i ^ j) & 1) coe = mod - coe;
for (int k = 0; k <= n - j; ++k) poly[i][k] = (poly[i][k] + (ll)poly[j + 1][k] * coe) % mod;
}
}
return vector<int>(poly[1], poly[1] + n + 1);
}
template<class T>
int det(int n, T mat) {
static int a[N + 5][N + 5];
for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = mat[i][j];
int ret = 1;
for (int i = 1; i <= n; ++i) {
int pivot = i;
for (; pivot <= n && !a[pivot][i]; ++pivot);
if (pivot > n) return 0;
if (pivot > i) {
ret = mod - ret;
for (int j = i; j <= n; ++j) swap(a[i][j], a[pivot][j]);
}
int nv = mpow(a[i][i], mod - 2);
for (int j = i + 1; j <= n; ++j)
if (a[j][i]) {
int t = (ll)a[j][i] * nv % mod;
for (int k = i; k <= n; ++k) a[j][k] = (a[j][k] + (ll)(mod - t) * a[i][k]) % mod;
}
}
for (int i = 1; i <= n; ++i) ret = (ll)ret * a[i][i] % mod;
return ret;
}
template<class T>
vector<int> detPoly(int n, int d, T mat) {
static int a[D + 1][N + 5][N + 5], b[N + 5][N + 5];
for (int e = 0; e <= d; ++e)
for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[e][i][j] = mat[e][i][j];
int offset = 0, coe = 1;
for (int i = 1; i <= n; ++i) {
int pivot = n + 1;
for (int rep = 0; ; ++rep) {
for (int j = 1; j < i; ++j)
if (a[d][j][i]) {
int t = mod - a[d][j][i];
for (int e = 0; e <= d; ++e)
for (int k = 1; k <= n; ++k)
if (a[e][k][j])
a[e][k][i] = (a[e][k][i] + (ll)a[e][k][j] * t) % mod;
}
for (pivot = i; pivot <= n && !a[d][pivot][i]; ++pivot);
if (pivot <= n || rep == d) break;
++offset;
for (int e = d; e; --e)
for (int j = 1; j <= n; ++j) a[e][j][i] = a[e - 1][j][i];
for (int j = 1; j <= n; ++j) a[0][j][i] = 0;
}
if (pivot > n) return vector<int>(n * d + 1, 0);
if (pivot > i) {
coe = mod - coe;
for (int e = 0; e <= d; ++e)
for (int j = 1; j <= n; ++j) swap(a[e][i][j], a[e][pivot][j]);
}
int nv = mpow(a[d][i][i], mod - 2); coe = (ll)coe * a[d][i][i] % mod;
for (int e = 0; e <= d; ++e)
for (int j = 1; j <= n; ++j)
if (a[e][i][j]) a[e][i][j] = (ll)a[e][i][j] * nv % mod;
for (int j = i + 1; j <= n; ++j)
if (a[d][j][i]) {
int t = mod - a[d][j][i];
for (int e = 0; e <= d; ++e)
for (int k = 1; k <= n; ++k)
if (a[e][i][k]) a[e][j][k] = (a[e][j][k] + (ll)a[e][i][k] * t) % mod;
}
}
for (int i = 1; i <= n * (d - 1); ++i) b[i][n + i] = 1;
for (int e = 0; e < d; ++e)
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
b[n * (d - 1) + i][n * e + j] = neg(a[e][i][j]);
auto res = charPoly(n * d, b);
vector<int> ret(n * d - offset + 1);
for (int i = 0; i < ret.size(); ++i) ret[i] = (ll)coe * res[i + offset] % mod;
ret.resize(n * d + 1);
return ret;
}
}
using Matrix::detPoly;
const int N = 402;
int n, m, k;
int a[N + 5], b[N + 5];
int s[N + 5][N + 5], pre[N + 5][N + 5];
int f[2][N + 5][N + 5], g[N + 5][N + 5];
int mat[3][N + 5][N + 5], len;
int ans[N + 5];
int main() {
scanf("%d%d%d", &n, &m, &k);
for (int i = 1; i <= n; ++i) scanf("%d", a + i);
for (int i = 1; i <= m; ++i) scanf("%d", b + i);
for (int i = 1; i <= k; ++i)
for (int j = 1; j <= k; ++j) {
scanf("%1d", s[i] + j);
if (!s[i][j]) pre[i][j] = j;
else pre[i][j] = pre[i][j - 1];
}
for (int i = 1; i < m; ++i)
for (int j = i + 1; j <= m; ++j) {
int x0 = pre[k][b[i]], x1 = max(b[i], pre[k][b[j]]);
add(f[k & 1][b[i]][b[j]], 1),
sub(f[k & 1][b[i]][x1], 1),
sub(f[k & 1][x0][b[j]], 1),
add(f[k & 1][x0][x1], 1);
}
for (int i = k; i; --i)
for (int j = k; j; --j)
add(f[k & 1][i][j], f[k & 1][i + 1][j]),
add(f[k & 1][i][j], f[k & 1][i][j + 1]),
sub(f[k & 1][i][j], f[k & 1][i + 1][j + 1]);
for (int r = k - 1; r; --r) {
memset(f[r & 1], 0, sizeof f[r & 1]);
for (int i = 1; i < k; ++i)
for (int j = i + 1, v; j <= k; ++j)
if ((v = f[~r & 1][i][j]) && s[r][i] && s[r][j]) {
int x0 = pre[r][i], x1 = max(i, pre[r][j]);
add(f[r & 1][i][j], v),
sub(f[r & 1][i][x1], v),
sub(f[r & 1][x0][j], v),
add(f[r & 1][x0][x1], v);
}
for (int i = k; i; --i)
for (int j = k; j; --j)
add(f[r & 1][i][j], f[r & 1][i + 1][j]),
add(f[r & 1][i][j], f[r & 1][i][j + 1]),
sub(f[r & 1][i][j], f[r & 1][i + 1][j + 1]);
}
for (int i = 1; i <= m; ++i) if (s[k][b[i]]) g[k][b[i]] = 1;
for (int i = k; i; --i)
for (int j = k; j; --j)
if (s[i][j])
add(g[i][j], g[i][j + 1]), add(g[i][j], g[i + 1][j]);
len = n + 1 + (~n & 1);
for (int i = 1; i < len; ++i)
for (int j = i + 1; j <= len; ++j)
mat[0][i][j] = ~(i ^ j) & 1 ? mod - 1 : 1;
for (int i = 1; i < n; ++i)
for (int j = i + 1; j <= n; ++j)
mat[2][i][j] = f[1][a[i]][a[j]];
for (int i = 1; i <= n; ++i) mat[1][i][n + 1] = g[1][a[i]];
for (int e = 0; e < 3; ++e)
for (int i = 1; i < len; ++i)
for (int j = i + 1; j <= len; ++j)
mat[e][j][i] = neg(mat[e][i][j]);
auto res = detPoly(len, 2, mat);
ans[0] = 1;
for (int i = 1; i <= n; ++i) {
ans[i] = res[i];
for (int j = 1; j < i; ++j) ans[i] = (ans[i] + (ll)(mod - ans[j]) * ans[i - j]) % mod;
ans[i] = quo2(ans[i]);
}
for (int i = n; i >= 0; --i)
if (ans[i]) { printf("%d %d\n", i, ans[i]); break; }
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 17312kb
input:
7 7 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1111111 1111111 1111111 1111111 1111111 1111111 1111111
output:
7 1
result:
ok 2 number(s): "7 1"
Test #2:
score: 0
Accepted
time: 2ms
memory: 19748kb
input:
7 7 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1111111 1111111 1111111 1111111 1111111 1111111 1111111
output:
7 1
result:
ok 2 number(s): "7 1"
Test #3:
score: 0
Accepted
time: 3ms
memory: 20140kb
input:
7 7 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1111111 1111111 1111111 1111111 1111111 1111111 1111111
output:
7 1
result:
ok 2 number(s): "7 1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 17280kb
input:
7 7 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1111111 1111111 1111111 1111111 1111111 1110111 1111111
output:
6 52
result:
ok 2 number(s): "6 52"
Test #5:
score: 0
Accepted
time: 0ms
memory: 19536kb
input:
7 7 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1111111 1111111 1111111 1111111 1111111 1110111 1111111
output:
6 52
result:
ok 2 number(s): "6 52"
Subtask #2:
score: 5
Accepted
Dependency #1:
100%
Accepted
Test #6:
score: 5
Accepted
time: 0ms
memory: 19484kb
input:
16 17 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 111111111111111111 111111111111111111 111011111111111111 111111111111111111 111111111111111111 111011110111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 1...
output:
14 328354990
result:
ok 2 number(s): "14 328354990"
Test #7:
score: 0
Accepted
time: 0ms
memory: 21524kb
input:
17 16 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111101111111111 111111111111111111 111111111111011111 ...
output:
15 449998848
result:
ok 2 number(s): "15 449998848"
Test #8:
score: 0
Accepted
time: 0ms
memory: 18500kb
input:
16 18 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 111111111111110111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111110111111 111111111111111111 11111111111111111...
output:
15 844316215
result:
ok 2 number(s): "15 844316215"
Test #9:
score: 0
Accepted
time: 0ms
memory: 19740kb
input:
16 17 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 111111111111111111 111111111111111111 111011111111110111 111111111111111111 111111111111111111 111011111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 1...
output:
15 133840
result:
ok 2 number(s): "15 133840"
Test #10:
score: 0
Accepted
time: 0ms
memory: 18664kb
input:
18 18 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111111111111 111111111011111111 111111111111111111 111101111111111111 111111111111111111 11111111111...
output:
16 27330297
result:
ok 2 number(s): "16 27330297"
Subtask #3:
score: 10
Accepted
Dependency #2:
100%
Accepted
Test #11:
score: 10
Accepted
time: 302ms
memory: 17524kb
input:
10 377 400 1 2 3 4 5 6 7 8 9 10 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 ...
output:
10 843273461
result:
ok 2 number(s): "10 843273461"
Test #12:
score: 0
Accepted
time: 302ms
memory: 19172kb
input:
10 367 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104...
output:
10 273577493
result:
ok 2 number(s): "10 273577493"
Test #13:
score: 0
Accepted
time: 293ms
memory: 18820kb
input:
10 350 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 105 106 107 108 109 110 11...
output:
9 605707862
result:
ok 2 number(s): "9 605707862"
Test #14:
score: 0
Accepted
time: 301ms
memory: 20424kb
input:
10 375 400 1 2 3 4 5 6 7 8 9 10 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 101...
output:
10 213051017
result:
ok 2 number(s): "10 213051017"
Test #15:
score: 0
Accepted
time: 296ms
memory: 18940kb
input:
10 330 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ...
output:
9 320097125
result:
ok 2 number(s): "9 320097125"
Test #16:
score: 0
Accepted
time: 303ms
memory: 18344kb
input:
10 360 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 105 106 107...
output:
10 195548453
result:
ok 2 number(s): "10 195548453"
Test #17:
score: 0
Accepted
time: 307ms
memory: 18732kb
input:
10 365 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 10...
output:
10 20617593
result:
ok 2 number(s): "10 20617593"
Test #18:
score: 0
Accepted
time: 290ms
memory: 18236kb
input:
10 334 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 11...
output:
10 602177426
result:
ok 2 number(s): "10 602177426"
Test #19:
score: 0
Accepted
time: 290ms
memory: 19324kb
input:
10 323 400 1 2 3 4 5 6 7 8 9 10 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 1...
output:
9 619229914
result:
ok 2 number(s): "9 619229914"
Test #20:
score: 0
Accepted
time: 314ms
memory: 18996kb
input:
10 379 400 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 1...
output:
10 409116219
result:
ok 2 number(s): "10 409116219"
Subtask #4:
score: 25
Accepted
Dependency #3:
100%
Accepted
Test #21:
score: 25
Accepted
time: 308ms
memory: 20684kb
input:
100 322 400 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:
85 207066474
result:
ok 2 number(s): "85 207066474"
Test #22:
score: 0
Accepted
time: 315ms
memory: 21596kb
input:
100 334 400 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:
84 608992198
result:
ok 2 number(s): "84 608992198"
Test #23:
score: 0
Accepted
time: 313ms
memory: 21192kb
input:
100 373 400 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:
87 22076236
result:
ok 2 number(s): "87 22076236"
Test #24:
score: 0
Accepted
time: 306ms
memory: 20532kb
input:
100 327 400 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:
87 819624712
result:
ok 2 number(s): "87 819624712"
Test #25:
score: 0
Accepted
time: 313ms
memory: 22096kb
input:
100 326 400 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:
89 339092727
result:
ok 2 number(s): "89 339092727"
Test #26:
score: 0
Accepted
time: 318ms
memory: 20908kb
input:
100 366 400 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:
87 577188664
result:
ok 2 number(s): "87 577188664"
Test #27:
score: 0
Accepted
time: 333ms
memory: 22392kb
input:
100 394 400 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:
86 909840591
result:
ok 2 number(s): "86 909840591"
Test #28:
score: 0
Accepted
time: 328ms
memory: 20692kb
input:
100 389 400 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:
87 793712350
result:
ok 2 number(s): "87 793712350"
Test #29:
score: 0
Accepted
time: 316ms
memory: 19824kb
input:
100 334 400 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:
89 8486281
result:
ok 2 number(s): "89 8486281"
Test #30:
score: 0
Accepted
time: 310ms
memory: 21384kb
input:
100 367 400 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:
87 419573333
result:
ok 2 number(s): "87 419573333"
Subtask #5:
score: 10
Accepted
Test #31:
score: 10
Accepted
time: 254ms
memory: 22524kb
input:
73 73 400 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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 ...
output:
73 849796347
result:
ok 2 number(s): "73 849796347"
Test #32:
score: 0
Accepted
time: 247ms
memory: 21636kb
input:
68 68 400 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...
output:
68 334069950
result:
ok 2 number(s): "68 334069950"
Test #33:
score: 0
Accepted
time: 246ms
memory: 18708kb
input:
72 72 400 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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133...
output:
72 180096245
result:
ok 2 number(s): "72 180096245"
Test #34:
score: 0
Accepted
time: 253ms
memory: 18848kb
input:
71 71 400 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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 13...
output:
71 234343448
result:
ok 2 number(s): "71 234343448"
Test #35:
score: 0
Accepted
time: 252ms
memory: 21380kb
input:
68 68 400 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...
output:
68 371509898
result:
ok 2 number(s): "68 371509898"
Test #36:
score: 0
Accepted
time: 367ms
memory: 22008kb
input:
200 200 400 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:
200 852372194
result:
ok 2 number(s): "200 852372194"
Test #37:
score: 0
Accepted
time: 434ms
memory: 21616kb
input:
230 230 400 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:
230 65874836
result:
ok 2 number(s): "230 65874836"
Test #38:
score: 0
Accepted
time: 512ms
memory: 21904kb
input:
260 260 400 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:
260 272563656
result:
ok 2 number(s): "260 272563656"
Test #39:
score: 0
Accepted
time: 605ms
memory: 23772kb
input:
290 290 400 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:
290 95450701
result:
ok 2 number(s): "290 95450701"
Test #40:
score: 0
Accepted
time: 731ms
memory: 22764kb
input:
320 320 400 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:
320 266455174
result:
ok 2 number(s): "320 266455174"
Subtask #6:
score: 25
Accepted
Dependency #5:
100%
Accepted
Test #41:
score: 25
Accepted
time: 319ms
memory: 22968kb
input:
107 371 400 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:
107 3979643
result:
ok 2 number(s): "107 3979643"
Test #42:
score: 0
Accepted
time: 310ms
memory: 20456kb
input:
101 351 400 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:
101 372994325
result:
ok 2 number(s): "101 372994325"
Test #43:
score: 0
Accepted
time: 313ms
memory: 22668kb
input:
101 369 400 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:
101 46156842
result:
ok 2 number(s): "101 46156842"
Test #44:
score: 0
Accepted
time: 323ms
memory: 20184kb
input:
101 386 400 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:
101 634357614
result:
ok 2 number(s): "101 634357614"
Test #45:
score: 0
Accepted
time: 332ms
memory: 21420kb
input:
109 388 400 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:
109 24613754
result:
ok 2 number(s): "109 24613754"
Test #46:
score: 0
Accepted
time: 418ms
memory: 22336kb
input:
200 399 400 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:
200 342259639
result:
ok 2 number(s): "200 342259639"
Test #47:
score: 0
Accepted
time: 473ms
memory: 23536kb
input:
230 393 400 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:
230 596706635
result:
ok 2 number(s): "230 596706635"
Test #48:
score: 0
Accepted
time: 541ms
memory: 22960kb
input:
260 393 400 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:
260 569883617
result:
ok 2 number(s): "260 569883617"
Test #49:
score: 0
Accepted
time: 627ms
memory: 23756kb
input:
290 395 400 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:
290 473037952
result:
ok 2 number(s): "290 473037952"
Test #50:
score: 0
Accepted
time: 734ms
memory: 23276kb
input:
320 397 400 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:
320 375576485
result:
ok 2 number(s): "320 375576485"
Subtask #7:
score: 20
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #51:
score: 20
Accepted
time: 340ms
memory: 23648kb
input:
400 375 400 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:
0 1
result:
ok 2 number(s): "0 1"
Test #52:
score: 0
Accepted
time: 546ms
memory: 23040kb
input:
400 346 400 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:
44 259349435
result:
ok 2 number(s): "44 259349435"
Test #53:
score: 0
Accepted
time: 669ms
memory: 23464kb
input:
400 368 400 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:
92 934744081
result:
ok 2 number(s): "92 934744081"
Test #54:
score: 0
Accepted
time: 720ms
memory: 23096kb
input:
400 331 400 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:
118 819815069
result:
ok 2 number(s): "118 819815069"
Test #55:
score: 0
Accepted
time: 660ms
memory: 23660kb
input:
355 385 400 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:
154 827736761
result:
ok 2 number(s): "154 827736761"
Test #56:
score: 0
Accepted
time: 830ms
memory: 23016kb
input:
400 380 400 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:
165 936566720
result:
ok 2 number(s): "165 936566720"
Test #57:
score: 0
Accepted
time: 766ms
memory: 23248kb
input:
382 335 400 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:
164 615816056
result:
ok 2 number(s): "164 615816056"
Test #58:
score: 0
Accepted
time: 838ms
memory: 23156kb
input:
400 324 400 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:
180 258747176
result:
ok 2 number(s): "180 258747176"
Test #59:
score: 0
Accepted
time: 854ms
memory: 24280kb
input:
400 326 400 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:
191 245039016
result:
ok 2 number(s): "191 245039016"
Test #60:
score: 0
Accepted
time: 676ms
memory: 22972kb
input:
333 388 400 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:
212 219763298
result:
ok 2 number(s): "212 219763298"
Extra Test:
score: 0
Extra Test Passed