QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#659866 | #7152. Tri-color spanning tree | ohwphil | AC ✓ | 108ms | 24860kb | C++17 | 14.0kb | 2024-10-19 22:45:23 | 2024-10-19 22:45:24 |
Judging History
answer
#include <bits/stdc++.h>
#include <random>
using namespace std;
// ref: https://judge.yosupo.jp/submission/102040
template<int M> struct MINT {
long long v;
static MINT<M> w;
MINT<M>() : v(0) {}
MINT<M>(const long long v) : v(v) { normalize(); }
void normalize() { v %= M; if (v < 0) v += M; }
friend istream& operator >> (istream& in, MINT<M>& a) { in >> a.v; a.normalize(); return in; }
friend ostream& operator << (ostream& out, const MINT<M>& a) { return out << a.v; }
friend MINT<M> pow(MINT<M> a, long long b) {
MINT<M> res = 1;
for (; b; b >>= 1, a *= a) if (b & 1) res *= a;
return res;
}
MINT<M> power(long long b) const { return pow(*this, b); }
MINT<M> mul_inv() const { return power(M - 2); }
MINT<M>& operator += (const MINT<M>& t) { if ((v += t.v) >= M) v -= M; return *this; }
MINT<M>& operator -= (const MINT<M>& t) { if ((v -= t.v) < 0) v += M; return *this; }
MINT<M>& operator *= (const MINT<M>& t) { v *= t.v; normalize(); return *this; }
MINT<M>& operator /= (const MINT<M>& t) { *this *= t.mul_inv(); normalize(); return *this; }
MINT<M> operator + (const MINT<M>& t) const { return MINT<M>(*this) += t; }
MINT<M> operator - (const MINT<M>& t) const { return MINT<M>(*this) -= t; }
MINT<M> operator * (const MINT<M>& t) const { return MINT<M>(*this) *= t; }
MINT<M> operator / (const MINT<M>& t) const { return MINT<M>(*this) /= t; }
MINT<M> operator - () const { return -v; }
bool operator == (const MINT<M>& t) const { return v == t.v; }
bool operator != (const MINT<M>& t) const { return v != t.v; }
operator int32_t() const { return v; }
operator int64_t() const { return v; }
};
template<int M>
void NTT(vector<MINT<M>>& a, bool inv_fft = false) {
int n = a.size(); vector<MINT<M>> root(n / 2);
for (int i = 1, j = 0; i < n; i++) {
int bit = n / 2;
while (j >= bit) j -= bit, bit >>= 1;
if (i < (j += bit)) swap(a[i], a[j]);
}
auto ang = MINT<M>::w.power((M - 1) / n); if (inv_fft) ang = ang.mul_inv();
root[0] = 1; for (int i = 1; i < n / 2; i++) root[i] = root[i - 1] * ang;
for (int i = 2; i <= n; i <<= 1) {
int step = n / i;
for (int j = 0; j < n; j += i) {
for (int k = 0; k < i / 2; k++) {
auto u = a[j + k], v = a[j + k + i / 2] * root[k * step];
a[j + k] = u + v; a[j + k + i / 2] = u - v;
}
}
}
auto inv = MINT<M>(n).mul_inv();
if (inv_fft) for (int i = 0; i < n; i++) a[i] = a[i] * inv;
}
template<typename T>
struct Poly {
vector<T> a;
Poly() : a() {}
Poly(T a0) : a(1, a0) { normalize(); }
Poly(const vector<T>& a) : a(a) { normalize(); }
void normalize() { while (!a.empty() && a.back() == T(0)) a.pop_back(); }
int size() const { return a.size(); }
int deg() const { return size() - 1; }
void push_back(const T& x) { a.push_back(x); }
T get(int idx) const { return 0 <= idx && idx < size() ? a[idx] : T(0); }
T& operator [] (int idx) { return a[idx]; }
Poly reversed() const { auto b = a; reverse(b.begin(), b.end()); return b; }
Poly trim(int sz) const { return vector<T>(a.begin(), a.begin() + min(sz, size())); }
Poly inv(int n) const {
Poly q(T(1) / a[0]);
for (int i = 1; i < n; i <<= 1) {
Poly p = Poly(2) - q * trim(i * 2);
q = (p * q).trim(i * 2);
}
return q.trim(n);
}
Poly operator *= (const T& x) { for (auto& i : a) i *= x; normalize(); return *this; }
Poly operator /= (const T& x) { return *this *= T(1) / x; }
Poly operator += (const Poly& t) {
a.resize(max(size(), t.size()));
for (int i = 0; i < t.size(); i++) a[i] += t.a[i];
normalize(); return *this;
}
Poly operator -= (const Poly& t) {
a.resize(max(size(), t.size()));
for (int i = 0; i < t.size(); i++) a[i] -= t.a[i];
normalize(); return *this;
}
Poly operator *= (const Poly& t) {
auto b = t.a;
int n = 2; while (n < a.size() + b.size()) n <<= 1;
a.resize(n); b.resize(n); NTT(a); NTT(b);
for (int i = 0; i < n; i++) a[i] *= b[i];
NTT(a, true); normalize(); return *this;
}
Poly operator /= (const Poly& t) {
if (deg() < t.deg()) return *this = Poly();
int sz = deg() - t.deg() + 1;
Poly ra = reversed().trim(sz), rb = t.reversed().trim(sz).inv(sz);
*this = (ra * rb).trim(sz);
for (int i = sz - size(); i; i--) a.push_back(T(0));
reverse(a.begin(), a.end()); normalize();
return *this;
}
Poly operator %= (const Poly& t) {
if (deg() < t.deg()) return *this;
Poly tmp = *this; tmp /= t; tmp *= t;
*this -= tmp; normalize();
return *this;
}
Poly operator + (const Poly& t) const { return Poly(*this) += t; }
Poly operator - (const Poly& t) const { return Poly(*this) -= t; }
Poly operator * (const Poly& t) const { return Poly(*this) *= t; }
Poly operator / (const Poly& t) const { return Poly(*this) /= t; }
Poly operator % (const Poly& t) const { return Poly(*this) %= t; }
Poly operator * (const T x) const { return Poly(*this) *= x; }
Poly operator / (const T x) const { return Poly(*this) /= x; }
T eval(T x) const {
T res = 0;
for (int i = deg(); i >= 0; i--) res = res * x + a[i];
return res;
}
Poly derivative() const {
vector<T> res;
for (int i = 1; i < size(); i++) res.push_back(T(i) * a[i]);
return res;
}
Poly integral() const {
vector<T> res{ T(0) };
for (int i = 0; i < size(); i++) res.push_back(a[i] / T(i + 1));
return res;
}
Poly ln(int n) const {
assert(size() > 0 && a[0] == T(1));
return (derivative() * inv(n)).integral().trim(n);
}
Poly exp(int n) const {
if (size() == 0) return Poly(1);
assert(size() > 0 && a[0] == T(0));
Poly res(1);
for (int i = 1; i < n; i <<= 1) {
auto t = Poly(1) + trim(i * 2) - res.ln(i * 2);
res = (res * t).trim(i * 2);
}
return res.trim(n);
}
Poly pow(long long n) {
// compute f(x)^n
vector<T> b = a;
b.resize(b.size() * n);
int sz = 2;
while (sz < b.size()) sz <<= 1;
b.resize(sz);
NTT(b);
for (int i = 0; i < b.size(); i++) {
b[i] = b[i].power(n);
}
NTT(b, true);
return Poly(b);
}
Poly pow(long long n, int k) const {
// compute f(x)^n mod x^k
Poly acc(1), t = *this;
t = t.trim(k);
for (; n; n >>= 1) {
if (n & 1) acc = (acc * t).trim(k);
t = (t * t).trim(k);
}
return acc;
}
};
using ModInt = MINT<1000000007>;
template<> ModInt ModInt::w = ModInt(3);
using T = ModInt;
// slow convolution
vector<ModInt> convolute_slow(vector<ModInt>& a, vector<ModInt>& b) {
vector<ModInt> c(a.size() + b.size() - 1, ModInt(0));
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < b.size(); j++) {
c[i + j] += a[i] * b[j];
}
}
return c;
}
// O(N^3) lagrange interpolation
vector<ModInt> interpolate_slow(vector<ModInt> x_points, vector<ModInt> y_points) {
int n = x_points.size();
vector<ModInt> res(n, ModInt(0));
for (int i = 0; i < n; ++i) {
ModInt multiplier = 1;
Poly<ModInt> num(1);
for (int j = 0; j < n; ++j) {
if (i == j) continue;
multiplier *= x_points[j] - x_points[i];
vector<ModInt> one_term = {-x_points[j], 1};
num = convolute_slow(num.a, one_term);
}
multiplier = y_points[i] / multiplier;
for (int j = 0; j < n; ++j) {
res[j] += num[j] * multiplier;
}
}
return res;
}
template <typename T>
class Matrix {
public:
vector<vector<T>> a;
int n, m;
Matrix() {}
Matrix(int n, int m, vector<vector<T>> a) : n(n), m(m), a(a) {}
Matrix<T> operator * (const Matrix<T>& b) {
assert(m == b.n);
vector<vector<T>> c(n, vector<T>(b.m, T(0)));
for (int i = 0; i < n; i++) {
for (int j = 0; j < b.m; j++) {
for (int k = 0; k < m; k++) {
c[i][j] += a[i][k] * b.a[k][j];
}
}
}
return Matrix<T>(n, b.m, c);
}
vector<T>& operator [] (int i) {
return a[i];
}
};
template <typename T>
class SquareMatrix : public Matrix<T> {
public:
SquareMatrix() {}
SquareMatrix(int n, vector<vector<T>> a) : Matrix<T>(n, n, a) {}
static SquareMatrix<T> identity(int n) {
vector<vector<T>> a(n, vector<T>(n, T(0)));
for (int i = 0; i < n; i++) {
a[i][i] = T(1);
}
return SquareMatrix<T>(n, a);
}
SquareMatrix<T> operator * (const SquareMatrix<T>& b) {
return SquareMatrix<T>(this->n, Matrix<T>::operator*(b).a);
}
SquareMatrix<T> pow(long long k) {
SquareMatrix<T> res = SquareMatrix<T>::identity(this->n);
SquareMatrix<T> a = *this;
for (; k; k >>= 1) {
if (k & 1) {
res = res * a;
}
a = a * a;
}
return res;
}
T determinant() {
int n = this->n;
vector<vector<T>> b = this->a;
T det = T(1);
for (int i = 0; i < n; i++) {
int idx = -1;
for (int j = i; j < n; j++) {
if (b[j][i] != T(0)) {
idx = j;
break;
}
}
if (idx == -1) {
return T(0);
}
if (i != idx) {
det = -det;
swap(b[i], b[idx]);
}
if (b[i][i] == T(0)) {
return T(0);
}
det *= b[i][i];
T inv = b[i][i].mul_inv();
for (int j = i + 1; j < n; j++) {
b[i][j] *= inv;
}
for (int j = i + 1; j < n; j++) {
for (int k = i + 1; k < n; k++) {
b[j][k] -= b[j][i] * b[i][k];
}
}
}
return det;
}
int rank() {
int n = this->n;
vector<vector<T>> b = this->a;
int res = 0;
for (int i = 0; i < n; i++) {
int idx = -1;
for (int j = i; j < n; j++) {
if (b[j][i] != T(0)) {
idx = j;
break;
}
}
if (idx == -1) {
continue;
}
res++;
if (i != idx) {
swap(b[i], b[idx]);
}
T inv = b[i][i].mul_inv();
for (int j = i + 1; j < n; j++) {
b[i][j] *= inv;
}
for (int j = i + 1; j < n; j++) {
for (int k = i + 1; k < n; k++) {
b[j][k] -= b[j][i] * b[i][k];
}
}
}
return res;
}
};
int N, M, G, B;
int a, b, c;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M >> G >> B;
if (N == 1) {
cout << 1 << '\n';
return 0;
}
vector<vector<SquareMatrix<ModInt>>> dp(N, vector<SquareMatrix<ModInt>>(N, SquareMatrix<ModInt>(N - 1, vector<vector<ModInt>>(N - 1, vector<ModInt>(N - 1, ModInt(0))))));
vector<SquareMatrix<ModInt>> storage(3, SquareMatrix<ModInt>(N - 1, vector<vector<ModInt>>(N - 1, vector<ModInt>(N - 1, ModInt(0)))));
while (M--) {
cin >> a >> b >> c;
a--, b--; c--;
if (a != N - 1) {
storage[c][a][a] += 1;
}
if (b != N - 1) {
storage[c][b][b] += 1;
}
if (a != N - 1 && b != N - 1) {
storage[c][a][b] -= 1;
storage[c][b][a] -= 1;
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int inner_i = 0; inner_i < N - 1; inner_i++) {
for (int inner_j = 0; inner_j < N - 1; inner_j++) {
dp[i][j][inner_i][inner_j] = storage[0][inner_i][inner_j];
dp[i][j][inner_i][inner_j] += storage[1][inner_i][inner_j] * ModInt(i);
dp[i][j][inner_i][inner_j] += storage[2][inner_i][inner_j] * ModInt(j);
}
}
}
}
vector<vector<ModInt>> determinants(N, vector<ModInt>(N, ModInt(0)));
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
determinants[i][j] = dp[i][j].determinant();
}
}
vector<ModInt> iota(N, ModInt(0));
for (int i = 0; i < N; i++) {
iota[i] = i;
}
for (int i = 0; i < N; i++) {
vector<ModInt> interpolate_vector;
for (int j = 0; j < N; j++) {
interpolate_vector.push_back(determinants[i][j]);
}
interpolate_vector = interpolate_slow(iota, interpolate_vector);
for (int j = 0; j < N; j++) {
determinants[i][j] = interpolate_vector[j];
}
}
for (int j = 0; j < N; j++) {
vector<ModInt> interpolate_vector;
for (int i = 0; i < N; i++) {
interpolate_vector.push_back(determinants[i][j]);
}
interpolate_vector = interpolate_slow(iota, interpolate_vector);
for (int i = 0; i < N; i++) {
determinants[i][j] = interpolate_vector[i];
}
}
ModInt ans = 0;
for (int i = 0; i <= G; i++) {
for (int j = 0; j <= B; j++) {
ans += determinants[i][j];
}
}
cout << ans << '\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3516kb
input:
2 3 0 0 1 2 1 1 2 2 1 2 3
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
3 6 1 0 1 2 1 1 2 1 2 3 1 2 3 2 3 1 2 3 1 2
output:
10
result:
ok 1 number(s): "10"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 10 2 1 2 1 1 1 2 1 4 2 1 4 2 2 4 3 2 5 2 1 2 5 3 3 2 3 4 1 3 5 4 1
output:
39
result:
ok 1 number(s): "39"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 10 1 0 5 4 1 1 3 1 1 3 1 3 5 3 2 5 3 5 4 3 5 2 1 1 4 1 3 2 3 5 3 1
output:
7
result:
ok 1 number(s): "7"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 10 2 2 2 1 3 4 3 2 5 4 2 1 4 3 4 3 3 5 3 1 4 3 1 1 2 3 5 1 3 3 2 3
output:
40
result:
ok 1 number(s): "40"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
5 10 1 0 1 3 1 4 3 2 4 1 1 2 5 2 3 4 1 2 3 3 1 2 1 1 3 3 1 3 2 1 5 1
output:
13
result:
ok 1 number(s): "13"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
5 10 1 2 5 3 3 4 2 2 1 4 3 5 4 3 3 2 2 2 1 2 1 5 2 3 5 2 5 1 2 5 4 3
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 10 1 2 5 2 2 5 4 3 4 1 2 3 2 1 4 3 1 5 1 1 2 1 3 5 1 3 3 1 2 3 4 2
output:
40
result:
ok 1 number(s): "40"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 10 1 2 2 3 3 1 3 2 4 1 3 4 5 2 2 4 1 1 3 2 2 1 2 3 2 1 5 3 3 5 2 3
output:
32
result:
ok 1 number(s): "32"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 10 1 2 2 1 1 5 2 3 4 3 2 3 5 1 2 4 3 2 1 1 4 5 2 1 3 1 4 2 3 3 2 3
output:
74
result:
ok 1 number(s): "74"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 10 0 3 5 1 2 4 3 2 2 1 1 5 3 3 4 5 2 5 4 2 2 5 1 4 2 1 1 4 2 1 2 3
output:
2
result:
ok 1 number(s): "2"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
5 10 0 1 5 2 2 2 4 1 3 5 1 1 2 3 2 5 2 1 5 1 3 2 3 3 4 2 3 1 2 3 4 1
output:
7
result:
ok 1 number(s): "7"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
10 20 2 4 5 7 2 5 2 3 2 1 2 8 6 1 10 7 1 5 8 3 2 9 3 2 10 1 4 5 2 7 4 3 10 9 2 6 9 1 10 6 1 5 7 3 10 6 2 10 5 2 7 2 2 9 1 2 3 8 3 9 4 2
output:
621
result:
ok 1 number(s): "621"
Test #14:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
10 20 3 3 9 4 3 7 1 2 6 5 1 10 4 3 7 9 2 7 1 1 2 9 1 6 5 3 4 10 1 5 10 1 2 5 1 5 10 2 5 4 2 3 2 2 9 8 2 1 3 2 8 3 3 2 9 1 5 4 1 4 8 1
output:
3318
result:
ok 1 number(s): "3318"
Test #15:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
10 20 2 5 2 6 3 2 4 2 7 9 2 4 1 3 9 2 2 1 7 2 1 4 3 1 6 2 3 7 1 8 7 2 1 6 1 10 8 2 2 6 3 5 9 3 7 10 3 4 5 3 4 6 2 9 3 1 2 7 3 1 7 1
output:
1039
result:
ok 1 number(s): "1039"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3776kb
input:
10 20 4 3 9 8 1 2 4 1 2 6 3 3 4 1 2 10 2 4 1 1 9 3 2 10 5 2 6 9 3 10 8 2 8 5 2 5 8 2 9 7 2 6 8 3 4 5 3 6 4 2 6 10 2 1 7 1 1 5 2 10 6 2
output:
6886
result:
ok 1 number(s): "6886"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
10 20 2 5 10 9 2 3 7 1 4 8 3 4 8 3 1 8 2 1 6 1 2 3 2 6 3 2 10 4 3 9 7 2 1 2 1 4 10 2 8 1 1 8 10 1 2 4 3 1 2 2 7 10 3 9 7 1 1 4 1 8 5 1
output:
1698
result:
ok 1 number(s): "1698"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
10 20 4 1 5 2 2 8 7 1 5 2 3 10 6 1 4 3 3 3 4 1 7 6 2 10 1 2 5 3 1 1 3 1 2 10 2 5 6 1 2 4 3 10 2 3 10 3 1 7 8 1 2 5 1 6 8 2 9 8 1 1 9 2
output:
4342
result:
ok 1 number(s): "4342"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
10 20 1 3 7 5 1 4 1 2 8 6 3 7 1 3 1 7 2 2 6 3 3 1 1 9 4 1 4 5 2 5 10 2 2 4 3 5 1 3 8 3 3 3 4 2 7 9 1 6 1 2 4 10 2 4 2 1 7 1 1 10 7 2
output:
60
result:
ok 1 number(s): "60"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
10 20 2 3 3 1 3 2 10 1 9 5 2 10 5 3 1 5 3 9 7 3 1 2 1 9 3 2 8 4 2 9 8 1 6 5 3 4 9 1 10 6 2 6 3 3 5 8 1 5 1 3 4 8 1 7 3 1 2 7 3 6 2 3
output:
3787
result:
ok 1 number(s): "3787"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
10 20 4 2 5 4 3 9 10 2 2 10 1 5 7 2 7 6 2 9 3 2 4 10 1 2 9 1 1 5 3 9 10 2 8 6 1 5 2 3 3 8 3 9 5 1 4 3 3 2 9 2 7 4 2 10 8 1 6 2 3 6 7 1
output:
1787
result:
ok 1 number(s): "1787"
Test #22:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
10 20 2 1 3 1 3 7 4 3 1 5 2 2 8 2 3 5 1 7 3 1 9 5 1 2 4 2 7 10 2 10 5 3 7 4 3 6 8 1 2 5 3 7 10 2 1 10 3 6 10 3 4 9 2 1 6 3 10 3 1 2 6 2
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 3ms
memory: 4784kb
input:
20 40 4 5 8 6 1 5 1 3 5 14 2 8 12 1 9 16 1 3 18 3 12 2 2 6 19 1 19 5 3 11 10 1 19 7 1 6 5 2 10 19 3 5 7 1 2 20 1 9 5 2 14 2 3 12 8 3 17 15 2 6 8 1 4 6 1 19 5 2 20 13 2 17 6 1 16 4 2 3 19 2 13 19 1 7 1 1 4 11 1 19 6 2 1 2 2 14 9 1 5 15 1 11 20 2 13 1 2 18 17 3 15 19 2 18 1 2 3 18 2 3 13 3
output:
6610857
result:
ok 1 number(s): "6610857"
Test #24:
score: 0
Accepted
time: 6ms
memory: 4840kb
input:
20 40 10 5 13 9 2 2 13 3 15 6 1 3 18 3 1 11 2 8 16 1 3 13 2 1 20 3 20 1 2 10 6 2 12 4 1 10 18 1 16 7 1 8 16 1 15 19 1 1 10 3 8 10 1 8 6 3 12 6 3 19 1 2 12 6 2 14 11 3 7 19 1 13 8 2 11 5 2 5 13 2 17 20 2 20 6 1 17 1 2 5 15 2 19 7 2 15 14 1 10 3 2 4 3 3 17 10 2 19 4 2 11 7 2 17 7 1 18 13 1 13 10 2
output:
195713537
result:
ok 1 number(s): "195713537"
Test #25:
score: 0
Accepted
time: 6ms
memory: 4904kb
input:
20 40 6 7 5 14 3 2 20 1 14 5 1 13 7 1 5 17 1 1 6 1 2 5 2 9 8 2 12 4 1 18 5 2 7 1 1 2 7 1 20 3 2 5 6 2 11 9 3 16 2 2 11 1 1 5 15 2 19 9 1 16 11 1 8 15 1 12 4 2 2 7 2 7 11 2 16 12 1 1 18 2 10 13 2 14 19 1 18 9 2 12 8 3 13 1 3 17 1 2 3 19 1 16 11 2 5 1 2 11 20 1 1 4 1 3 13 3 6 20 3 18 7 1
output:
82484006
result:
ok 1 number(s): "82484006"
Test #26:
score: 0
Accepted
time: 6ms
memory: 4788kb
input:
20 40 6 10 19 12 2 4 16 2 15 18 3 12 16 2 2 19 2 6 1 3 3 7 3 12 19 1 5 9 3 13 15 1 20 19 1 15 10 3 5 6 2 9 7 2 11 5 3 3 10 1 1 17 3 15 12 3 13 19 1 14 19 1 7 1 2 13 16 3 8 13 1 5 19 1 17 4 1 16 2 3 4 3 3 18 19 2 20 17 2 8 4 3 20 14 1 20 16 3 15 11 1 13 7 2 3 18 1 20 19 2 12 15 2 6 16 1 15 11 3 2 17 3
output:
446528417
result:
ok 1 number(s): "446528417"
Test #27:
score: 0
Accepted
time: 6ms
memory: 4912kb
input:
20 40 4 10 5 4 3 18 2 2 14 2 2 12 18 1 9 15 2 13 20 2 14 6 3 10 13 3 12 17 3 11 3 2 14 5 3 1 11 1 1 4 2 3 4 1 6 17 3 12 4 1 3 8 2 19 16 2 5 19 2 3 11 3 20 16 3 18 3 1 1 16 2 5 17 2 1 11 1 15 11 2 11 17 2 17 19 1 7 18 1 1 10 3 18 5 3 16 10 2 20 8 2 20 10 3 17 10 1 3 12 1 7 16 2 8 10 3 5 10 2 17 14 2
output:
61819
result:
ok 1 number(s): "61819"
Test #28:
score: 0
Accepted
time: 6ms
memory: 4772kb
input:
20 40 6 10 5 15 2 14 16 3 5 9 2 7 10 1 16 18 1 12 15 3 7 2 2 18 4 2 16 14 1 10 16 3 11 15 1 14 2 3 9 3 1 6 7 1 4 18 1 14 6 1 17 16 2 9 14 1 19 8 1 19 5 1 14 4 2 14 3 2 17 16 2 6 17 2 6 2 3 2 8 1 19 17 3 8 12 3 1 14 3 14 12 3 17 16 2 13 9 2 2 13 2 10 14 2 20 4 3 15 5 3 5 15 1 1 8 3 6 8 1 9 11 1
output:
84392785
result:
ok 1 number(s): "84392785"
Test #29:
score: 0
Accepted
time: 6ms
memory: 4764kb
input:
20 40 5 7 9 6 2 18 4 2 15 4 2 14 13 2 8 5 1 7 19 3 19 20 1 17 4 1 5 1 3 13 18 1 6 19 3 13 3 1 6 16 1 12 4 1 1 15 1 5 14 2 10 9 3 16 5 3 10 11 3 6 20 1 15 4 2 13 9 1 4 17 3 1 9 1 19 2 1 16 5 2 19 18 1 7 16 3 19 9 3 20 1 1 2 12 2 18 1 2 3 11 3 16 7 2 2 3 2 9 8 1 8 19 1 7 12 3 7 2 3 3 8 3
output:
218244865
result:
ok 1 number(s): "218244865"
Test #30:
score: 0
Accepted
time: 6ms
memory: 4840kb
input:
20 40 5 5 7 9 1 15 8 2 6 3 3 15 10 3 19 18 3 10 4 3 20 7 1 1 5 2 14 13 3 11 20 2 19 1 3 14 7 2 1 5 3 17 15 1 7 11 3 1 17 1 19 8 3 15 3 1 2 19 3 6 16 1 9 2 1 19 4 3 15 13 1 13 14 1 9 14 1 2 3 2 12 17 3 11 5 3 3 4 2 13 7 1 15 1 1 20 6 1 1 6 3 13 18 2 6 18 1 13 19 3 20 10 3 1 4 3 13 19 2 11 16 2
output:
4755701
result:
ok 1 number(s): "4755701"
Test #31:
score: 0
Accepted
time: 6ms
memory: 4772kb
input:
20 40 7 6 3 14 3 18 9 3 10 4 2 20 18 1 4 6 3 6 9 3 11 6 1 10 5 1 19 16 2 1 18 3 6 18 3 1 12 3 12 5 1 13 15 1 5 6 3 1 17 1 18 15 2 19 13 3 2 5 3 9 4 3 2 6 1 14 13 1 7 10 3 6 8 1 6 8 2 18 5 1 12 17 3 15 20 1 14 19 2 10 20 1 16 19 3 6 13 3 1 7 2 2 16 1 13 1 2 12 2 2 20 18 3 3 16 2 16 4 3 6 9 1
output:
64087172
result:
ok 1 number(s): "64087172"
Test #32:
score: 0
Accepted
time: 6ms
memory: 4792kb
input:
20 40 8 5 2 12 3 12 9 1 18 12 3 20 5 1 7 10 1 13 6 3 7 16 2 19 9 1 20 13 2 1 3 1 8 7 1 18 2 3 4 17 1 9 12 2 5 12 1 3 7 1 11 5 3 10 6 3 12 16 1 20 12 3 13 2 2 12 13 3 15 7 2 5 9 2 7 4 1 2 11 1 10 6 1 3 12 3 10 19 2 18 9 2 5 2 3 7 5 1 13 14 1 1 6 2 3 4 3 10 19 3 14 16 1 16 1 1 20 18 2 19 8 3
output:
75364945
result:
ok 1 number(s): "75364945"
Test #33:
score: 0
Accepted
time: 93ms
memory: 24720kb
input:
40 80 16 12 1 5 3 22 9 1 38 32 3 10 28 2 37 3 2 8 38 3 11 15 2 35 19 1 3 38 1 10 18 3 35 10 3 18 23 2 9 21 1 36 29 1 17 31 1 33 18 3 22 21 3 32 13 2 39 21 2 22 33 2 3 33 1 32 28 2 28 11 1 3 7 3 6 20 1 22 24 3 7 1 2 27 23 3 12 37 3 22 1 1 27 11 1 39 2 3 34 33 3 1 14 2 18 9 1 18 29 2 39 27 3 32 23 2 1...
output:
46618078
result:
ok 1 number(s): "46618078"
Test #34:
score: 0
Accepted
time: 93ms
memory: 24688kb
input:
40 80 12 12 20 25 2 8 16 3 3 9 3 34 5 2 30 36 1 26 38 1 14 9 1 17 21 1 28 7 2 25 19 3 15 11 2 37 10 1 23 12 3 10 18 1 17 11 2 1 33 1 23 6 3 8 18 2 17 33 1 32 17 2 22 6 3 1 32 2 5 25 2 18 35 2 25 18 2 12 14 2 2 13 2 8 25 3 5 38 3 2 7 2 30 11 1 17 2 1 8 2 1 26 7 2 22 27 3 28 15 2 30 2 3 40 13 2 31 21 ...
output:
733297013
result:
ok 1 number(s): "733297013"
Test #35:
score: 0
Accepted
time: 92ms
memory: 24684kb
input:
40 80 12 8 32 2 3 2 11 2 38 32 2 39 31 3 17 38 3 3 21 1 5 10 2 26 3 2 16 27 3 16 30 2 10 36 3 37 4 3 6 20 2 30 35 1 35 5 2 7 38 3 7 37 2 21 31 2 15 11 2 10 6 2 15 8 3 21 20 2 30 36 1 19 32 3 23 12 1 13 31 3 34 32 1 11 8 2 3 28 2 2 28 3 33 38 3 38 37 1 15 38 2 18 39 2 36 24 3 39 5 1 20 18 1 25 33 2 2...
output:
461131346
result:
ok 1 number(s): "461131346"
Test #36:
score: 0
Accepted
time: 93ms
memory: 24784kb
input:
40 80 14 12 16 36 1 33 35 2 10 11 3 32 36 3 19 20 1 21 7 1 15 33 3 36 35 3 16 22 3 2 15 3 13 14 2 32 17 1 4 26 2 6 38 3 19 18 3 3 40 3 6 39 3 6 35 2 32 2 2 10 32 1 1 18 2 28 12 2 27 37 1 28 22 1 19 13 2 12 28 3 14 35 2 39 11 1 19 22 1 2 19 1 22 3 3 28 11 2 28 2 3 20 4 3 39 20 1 22 11 3 25 30 1 33 30...
output:
678457037
result:
ok 1 number(s): "678457037"
Test #37:
score: 0
Accepted
time: 100ms
memory: 24776kb
input:
40 80 15 9 21 33 1 21 39 2 5 26 2 5 7 2 34 15 3 10 25 3 17 4 3 12 21 1 27 20 2 10 28 2 18 14 2 13 38 3 5 14 1 32 8 3 32 19 2 3 30 3 33 29 2 2 23 3 28 8 2 34 35 3 31 5 2 37 16 3 29 32 2 38 28 1 28 38 2 35 7 3 25 17 2 31 40 1 10 25 1 24 15 3 9 24 2 29 35 3 5 6 3 38 40 2 12 29 2 34 14 1 14 23 2 28 34 2...
output:
909420262
result:
ok 1 number(s): "909420262"
Test #38:
score: 0
Accepted
time: 94ms
memory: 24720kb
input:
40 80 16 13 36 38 1 27 24 2 40 16 1 12 36 1 13 33 1 16 39 1 30 11 3 34 30 1 15 23 2 36 11 3 10 38 3 17 11 2 8 39 3 33 7 1 32 10 2 39 25 3 31 8 1 11 7 1 28 25 2 10 7 3 4 26 2 7 18 2 24 22 1 18 21 3 14 8 2 11 33 2 20 12 3 22 20 2 22 10 2 32 33 3 31 15 1 38 16 3 13 29 3 6 22 3 11 22 3 38 31 2 29 16 1 3...
output:
995630943
result:
ok 1 number(s): "995630943"
Test #39:
score: 0
Accepted
time: 100ms
memory: 24716kb
input:
40 80 16 12 6 40 1 25 26 3 8 26 1 14 27 1 26 3 3 31 16 2 8 33 2 22 3 2 3 38 2 18 13 3 17 7 3 35 23 3 33 18 1 4 38 1 26 29 2 9 28 3 23 27 3 27 10 1 15 2 1 40 35 3 18 32 3 7 25 3 33 40 1 25 4 3 3 27 1 16 5 2 35 20 1 9 2 1 13 3 3 4 38 3 23 21 2 34 16 3 27 38 2 29 27 2 4 26 1 40 27 1 7 19 3 20 7 2 2 16 ...
output:
119701092
result:
ok 1 number(s): "119701092"
Test #40:
score: 0
Accepted
time: 97ms
memory: 24788kb
input:
40 80 16 9 9 39 3 24 15 1 1 21 2 4 18 3 31 14 3 21 36 3 33 11 2 25 18 1 36 17 2 6 12 2 30 6 3 1 4 3 24 31 2 9 15 2 4 34 2 17 38 1 23 10 2 12 9 1 18 38 2 38 8 3 11 13 2 36 29 2 35 4 3 6 34 1 38 21 2 38 15 3 25 7 3 12 33 1 34 9 1 8 4 2 32 37 1 4 11 2 8 28 2 16 2 2 27 28 2 21 5 1 35 16 3 33 30 2 9 35 3...
output:
263640306
result:
ok 1 number(s): "263640306"
Test #41:
score: 0
Accepted
time: 92ms
memory: 24692kb
input:
40 80 12 13 29 30 3 16 28 1 17 40 1 9 30 2 20 36 1 33 21 3 29 19 2 29 19 2 27 32 3 25 12 2 2 28 2 6 23 1 17 31 2 8 35 3 32 30 1 4 6 2 9 38 2 13 30 2 26 33 2 13 10 1 10 24 2 34 14 3 28 36 1 23 3 2 36 7 1 6 8 1 21 16 1 3 16 2 36 23 3 22 6 2 31 39 3 38 17 2 2 15 1 14 6 2 28 33 3 22 35 1 39 24 1 22 13 3...
output:
147170504
result:
ok 1 number(s): "147170504"
Test #42:
score: 0
Accepted
time: 90ms
memory: 24644kb
input:
40 80 14 13 28 31 2 30 32 3 31 25 1 35 36 2 6 39 2 36 22 1 9 7 2 20 38 2 25 29 3 19 20 3 7 8 2 39 8 1 20 24 3 3 6 1 9 40 3 29 19 2 10 13 3 37 33 2 1 38 1 25 30 3 19 15 3 40 12 3 24 7 3 24 1 3 38 28 3 5 7 1 18 29 2 4 6 1 9 7 2 22 30 1 8 23 2 38 1 3 33 34 1 32 29 1 1 32 2 10 22 3 17 9 1 19 32 1 23 12 ...
output:
297418878
result:
ok 1 number(s): "297418878"
Test #43:
score: 0
Accepted
time: 16ms
memory: 4828kb
input:
20 100000 4 4 13 19 3 9 18 2 12 13 2 20 2 2 4 1 2 13 18 3 19 14 2 20 17 2 14 17 2 1 8 1 9 2 3 17 18 1 4 5 3 8 15 1 10 1 1 2 1 3 16 10 2 15 1 2 1 5 3 10 18 3 19 1 1 14 13 2 18 10 2 7 12 1 13 1 2 6 9 1 15 13 2 4 8 3 16 10 1 17 16 3 20 2 2 9 4 3 1 11 1 4 18 1 3 2 1 3 5 3 12 1 3 13 8 3 1 6 3 5 2 1 11 9 ...
output:
973042182
result:
ok 1 number(s): "973042182"
Test #44:
score: 0
Accepted
time: 12ms
memory: 4960kb
input:
20 100000 3 7 20 15 3 2 8 3 1 12 3 2 20 3 12 15 3 16 14 3 14 2 1 4 5 1 3 13 1 13 2 3 6 16 2 2 10 2 15 14 2 16 5 1 4 14 2 20 14 3 20 7 2 3 9 2 1 20 3 2 4 2 18 20 3 20 5 3 4 16 1 9 12 2 5 9 2 19 11 2 5 1 2 20 18 1 12 16 1 13 17 3 8 1 1 18 8 2 12 9 3 6 13 3 19 14 1 13 14 1 1 18 3 4 3 1 13 11 2 18 17 3 ...
output:
717230121
result:
ok 1 number(s): "717230121"
Test #45:
score: 0
Accepted
time: 12ms
memory: 4848kb
input:
20 100000 9 6 11 12 1 1 5 1 15 16 1 6 11 1 6 20 2 16 12 3 3 18 2 15 7 1 10 6 1 16 18 3 12 9 2 19 1 1 6 11 3 10 3 1 18 9 1 14 12 2 12 2 3 15 8 3 13 19 1 15 6 1 17 8 2 8 13 1 2 3 1 6 16 2 14 4 2 20 14 1 8 2 3 14 9 1 6 2 3 9 20 1 8 20 1 3 7 3 16 10 1 12 11 2 5 19 1 20 19 3 9 3 1 5 7 3 15 18 2 1 10 2 9 ...
output:
523302000
result:
ok 1 number(s): "523302000"
Test #46:
score: 0
Accepted
time: 16ms
memory: 4768kb
input:
20 100000 11 4 12 8 1 16 3 3 1 16 2 20 14 3 5 11 2 14 16 1 14 7 1 12 17 3 9 20 1 10 18 2 12 20 2 5 9 2 13 4 3 14 4 3 11 13 1 3 19 3 18 8 1 3 16 2 8 5 1 19 12 3 19 4 3 1 7 2 15 8 3 17 2 3 9 7 3 20 10 1 18 9 2 17 16 3 9 18 1 7 11 3 11 15 1 8 4 1 14 12 2 2 16 2 11 13 1 2 19 1 1 12 3 19 17 1 18 10 2 4 1...
output:
627312150
result:
ok 1 number(s): "627312150"
Test #47:
score: 0
Accepted
time: 13ms
memory: 4796kb
input:
20 100000 8 3 19 13 2 2 14 2 17 8 1 11 5 3 13 9 1 10 3 3 1 16 1 1 10 1 6 9 2 19 8 1 10 17 3 16 4 1 1 6 2 6 15 3 1 18 2 11 16 1 14 13 1 10 7 1 7 17 2 10 14 1 11 15 1 19 1 1 6 19 2 3 1 1 10 17 3 9 13 1 2 9 3 5 13 3 7 11 1 16 7 1 3 6 2 20 2 2 20 9 1 7 17 2 13 4 2 13 20 2 13 14 2 10 6 2 19 7 3 16 5 2 9 ...
output:
659093814
result:
ok 1 number(s): "659093814"
Test #48:
score: 0
Accepted
time: 16ms
memory: 4748kb
input:
20 100000 4 9 7 18 1 16 2 3 4 8 3 9 2 2 3 1 2 8 13 1 7 15 3 13 6 3 4 3 3 3 17 1 6 8 2 2 17 1 10 19 2 13 9 3 18 15 3 16 7 1 16 7 2 10 11 3 15 1 3 6 1 1 10 13 2 10 14 3 6 7 3 9 3 1 10 16 2 1 6 3 3 16 2 5 6 3 5 20 3 15 9 1 2 16 2 20 15 2 3 2 1 10 5 3 5 11 2 20 13 3 19 6 3 11 12 1 6 17 3 5 7 1 1 8 1 6 1...
output:
105251930
result:
ok 1 number(s): "105251930"
Test #49:
score: 0
Accepted
time: 16ms
memory: 4848kb
input:
20 100000 6 5 15 13 2 14 17 2 2 11 3 11 13 3 20 3 1 13 1 2 9 8 1 1 17 2 18 5 2 18 15 1 1 11 3 7 16 2 13 2 1 2 9 1 1 17 2 19 18 1 17 9 3 1 11 2 11 1 2 2 19 1 6 1 1 20 13 3 5 20 3 13 6 3 20 11 1 6 12 2 13 15 3 20 16 1 19 17 2 12 18 3 1 8 3 10 7 3 19 15 3 16 1 1 8 15 1 1 20 3 10 17 1 1 4 1 11 10 2 2 18...
output:
161220215
result:
ok 1 number(s): "161220215"
Test #50:
score: 0
Accepted
time: 16ms
memory: 4772kb
input:
20 100000 5 10 7 2 1 17 2 3 2 10 3 15 16 3 9 12 1 3 17 1 4 18 3 4 13 1 10 16 2 6 10 3 20 5 1 16 10 1 17 20 3 3 2 1 12 15 2 18 15 2 12 19 1 8 2 3 16 9 3 17 1 1 18 4 3 4 20 1 11 6 3 6 10 3 14 4 2 4 7 1 19 9 2 12 18 3 12 6 3 13 5 1 18 9 3 7 20 1 9 5 3 9 5 3 11 10 1 2 14 3 8 1 2 9 11 1 6 12 2 19 3 1 4 1...
output:
13239242
result:
ok 1 number(s): "13239242"
Test #51:
score: 0
Accepted
time: 9ms
memory: 4828kb
input:
20 100000 7 4 13 11 1 3 16 3 6 18 2 8 7 2 14 12 2 13 4 2 17 15 2 15 10 2 15 6 3 4 7 2 12 5 3 3 15 1 19 2 2 11 13 3 6 17 2 7 1 3 7 13 3 19 4 1 10 15 1 14 15 2 14 9 3 15 17 1 13 15 3 8 18 1 6 4 2 13 11 3 15 18 2 3 9 1 1 15 3 1 11 2 10 9 2 4 13 3 19 16 2 17 19 1 13 3 3 7 3 3 3 12 3 2 3 2 16 12 1 19 10 ...
output:
490005853
result:
ok 1 number(s): "490005853"
Test #52:
score: 0
Accepted
time: 12ms
memory: 4788kb
input:
20 100000 6 10 19 11 1 13 16 2 12 20 3 1 10 3 10 4 2 10 4 1 9 2 1 13 8 1 20 15 1 12 5 1 16 14 3 18 15 1 1 12 2 18 6 2 2 17 2 18 14 2 17 5 3 3 9 1 12 9 2 8 1 2 16 20 3 8 6 2 10 1 3 4 9 2 12 3 3 11 16 2 12 15 3 17 1 1 5 7 3 18 11 2 19 15 3 11 2 1 17 4 2 15 14 1 3 5 3 10 19 1 11 7 3 20 7 2 13 20 2 9 11...
output:
855483153
result:
ok 1 number(s): "855483153"
Test #53:
score: 0
Accepted
time: 104ms
memory: 24776kb
input:
40 100000 14 17 15 40 1 26 27 1 35 13 1 5 32 1 13 38 1 22 20 3 9 10 1 14 39 2 38 33 1 30 8 3 10 36 1 8 2 1 34 24 3 37 10 3 40 36 1 21 13 2 29 21 2 4 13 3 28 15 3 39 37 2 29 22 2 30 11 1 4 39 1 28 5 2 4 14 3 26 37 1 3 26 1 37 20 2 27 23 2 39 30 2 31 10 2 36 6 2 14 17 2 29 14 1 17 25 3 35 36 2 9 11 1 ...
output:
460711046
result:
ok 1 number(s): "460711046"
Test #54:
score: 0
Accepted
time: 103ms
memory: 24728kb
input:
40 100000 15 11 13 24 3 38 39 1 12 34 2 22 35 2 2 3 2 13 39 1 39 10 1 19 24 3 8 38 1 7 3 2 25 4 1 34 7 2 34 15 2 16 11 2 15 23 1 11 15 3 26 29 2 8 37 1 16 33 2 8 10 3 8 29 3 13 19 1 30 40 3 4 26 2 5 36 1 3 28 3 22 37 3 6 18 3 21 10 3 10 1 2 34 3 3 14 38 2 21 32 3 32 23 1 14 28 3 2 13 1 36 28 1 4 11 ...
output:
447107860
result:
ok 1 number(s): "447107860"
Test #55:
score: 0
Accepted
time: 108ms
memory: 24728kb
input:
40 100000 13 18 10 23 3 3 22 2 14 36 1 31 30 2 1 29 3 35 38 3 6 23 3 6 29 2 10 20 1 18 29 2 4 11 3 37 10 3 34 4 1 14 35 1 28 32 2 5 27 3 8 28 2 34 20 1 6 10 3 22 15 2 36 22 2 7 28 1 30 21 3 9 22 3 32 1 1 1 25 2 24 14 2 18 21 2 11 26 2 16 19 1 21 31 1 7 12 1 13 21 2 25 15 1 24 32 1 34 32 1 25 7 2 6 2...
output:
807926058
result:
ok 1 number(s): "807926058"
Test #56:
score: 0
Accepted
time: 104ms
memory: 24724kb
input:
40 100000 14 16 23 1 3 20 17 2 9 38 3 9 35 1 1 2 1 38 10 3 15 3 3 9 4 1 39 36 2 12 37 1 37 21 1 21 6 2 10 7 3 12 22 1 30 14 2 24 6 3 20 33 1 39 13 2 17 32 1 28 32 1 36 18 3 34 9 1 33 26 3 39 33 1 31 9 3 35 32 1 33 25 3 17 11 1 10 38 2 33 18 1 7 19 3 5 4 1 19 26 2 10 40 2 7 14 2 9 40 1 31 12 2 28 19 ...
output:
615635961
result:
ok 1 number(s): "615635961"
Test #57:
score: 0
Accepted
time: 104ms
memory: 24856kb
input:
40 100000 18 12 35 30 1 5 17 1 5 31 1 38 29 2 15 30 3 16 14 2 7 10 1 18 38 2 11 37 1 29 20 3 9 8 2 34 19 1 6 1 2 24 38 3 13 12 3 7 13 1 14 2 3 2 27 3 17 24 1 4 21 2 39 26 1 8 26 2 31 38 2 15 4 2 19 4 2 15 25 2 1 28 3 30 25 1 4 30 3 13 12 2 26 13 1 19 2 1 26 8 2 8 26 1 14 5 2 40 9 1 20 27 2 11 15 2 3...
output:
309519760
result:
ok 1 number(s): "309519760"
Test #58:
score: 0
Accepted
time: 108ms
memory: 24832kb
input:
40 100000 12 15 5 13 1 6 38 2 24 4 2 7 38 1 25 38 2 4 9 2 20 33 2 7 19 3 7 32 2 12 18 1 22 18 1 38 11 3 11 23 3 14 11 2 18 27 2 32 4 3 2 40 3 8 9 2 2 12 2 20 10 3 33 16 3 36 23 2 16 5 1 26 15 2 3 11 3 34 37 1 9 4 1 13 40 3 26 28 3 31 2 1 8 4 1 10 23 3 19 30 3 4 7 3 21 4 3 2 4 1 7 14 3 27 40 3 13 16 ...
output:
752864274
result:
ok 1 number(s): "752864274"
Test #59:
score: 0
Accepted
time: 108ms
memory: 24860kb
input:
40 100000 17 10 15 36 2 27 33 2 4 3 2 11 27 1 22 40 2 22 40 2 34 19 3 7 34 3 39 10 3 12 13 3 3 9 3 3 10 1 32 24 2 12 32 3 31 4 2 24 14 2 31 1 1 35 23 3 40 24 2 1 3 2 2 38 1 25 1 3 14 12 1 25 3 1 26 22 1 35 29 2 27 33 3 10 5 3 33 9 1 1 33 1 1 29 2 8 3 2 1 33 1 6 26 3 9 6 3 8 28 1 38 34 3 3 21 2 27 23...
output:
786436519
result:
ok 1 number(s): "786436519"
Test #60:
score: 0
Accepted
time: 103ms
memory: 24728kb
input:
40 100000 13 13 38 36 3 26 12 1 24 26 3 14 27 1 40 11 3 12 31 3 10 27 3 10 5 1 14 4 3 7 37 3 35 38 2 33 15 1 22 32 2 1 2 3 17 32 1 31 7 1 8 33 3 38 2 3 2 14 2 36 32 2 21 13 2 37 1 2 2 13 2 27 31 2 28 32 3 37 25 1 10 2 1 8 24 3 11 24 2 22 13 3 37 15 2 15 35 1 2 25 3 8 5 2 23 18 3 30 34 3 16 12 3 16 3...
output:
664442650
result:
ok 1 number(s): "664442650"
Test #61:
score: 0
Accepted
time: 104ms
memory: 24784kb
input:
40 100000 9 12 35 16 2 16 34 2 37 39 3 8 39 1 38 9 2 31 13 2 32 10 1 4 5 3 6 33 3 23 10 2 19 8 3 37 34 1 31 26 3 11 10 2 18 32 2 30 12 3 38 19 2 29 6 1 40 1 1 39 6 3 22 19 2 2 11 1 4 33 1 22 26 1 20 17 2 34 6 3 38 11 2 40 26 1 23 12 2 13 34 2 5 14 3 29 3 2 28 9 1 16 7 2 8 37 1 4 34 1 34 26 3 37 33 3...
output:
729894507
result:
ok 1 number(s): "729894507"
Test #62:
score: 0
Accepted
time: 103ms
memory: 24788kb
input:
40 100000 15 12 27 33 1 3 29 2 8 29 1 3 40 1 37 19 1 36 12 3 16 40 2 5 34 3 11 18 2 21 31 3 7 16 1 37 7 3 38 18 3 2 28 2 36 38 2 16 34 1 4 24 3 25 35 2 30 20 3 20 39 2 38 25 2 40 3 3 37 29 3 5 35 3 4 22 3 23 30 3 6 27 2 12 1 2 16 17 3 10 15 1 24 29 3 17 6 1 39 4 2 31 18 3 19 5 1 37 13 3 3 40 3 8 23 ...
output:
507681852
result:
ok 1 number(s): "507681852"
Extra Test:
score: 0
Extra Test Passed