QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#276390 | #7197. 24 Data Structures You've Ever Heard Of | PetroTarnavskyi# | AC ✓ | 105ms | 36580kb | C++20 | 3.3kb | 2023-12-05 20:44:32 | 2023-12-05 20:44:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
const int N = 1 << 11;
int n;
int p[4], q[4];
int a[N];
LL prefSum[N][N];
LL ans = 0;
bool intersect(int l1, int r1, int l2, int r2)
{
return l2 < r1 && l1 < r2;
}
LL getSum(int i1, int j1, int i2, int j2)
{
return prefSum[i2][j2] - prefSum[i2][j1]
- prefSum[i1][j2] + prefSum[i1][j1];
}
bool solve(int u1, int u2, int v1, int v2)
{
assert(u1 < u2);
assert(v1 < v2);
FOR(i, 0, n)
{
FOR(j, i + 1, n)
{
if ((q[u1] - q[u2]) * (a[i] - a[j]) < 0)
continue;
VI l(4), r(4);
VI minValue(4), maxValue(4);
for (int v : {v1, v2})
{
if (q[v] < min(q[u1], q[u2]))
{
l[v] = 0;
r[v] = i;
}
else if (q[v] < max(q[u1], q[u2]))
{
l[v] = i + 1;
r[v] = j;
}
else
{
l[v] = j + 1;
r[v] = n;
}
if (v < u1)
{
minValue[v] = 0;
maxValue[v] = min(a[i], a[j]);
}
else if (v < u2)
{
minValue[v] = min(a[i], a[j]) + 1;
maxValue[v] = max(a[i], a[j]);
}
else
{
minValue[v] = max(a[i], a[j]) + 1;
maxValue[v] = n;
}
}
if (intersect(l[v1], r[v1], l[v2], r[v2]))
return false;
if (intersect(minValue[v1], maxValue[v1], minValue[v2], maxValue[v2]))
return false;
ans += getSum(l[v1], minValue[v1], r[v1], maxValue[v1]) * getSum(l[v2], minValue[v2], r[v2], maxValue[v2]);
}
}
cout << ans << "\n";
return true;
}
struct Fenwick
{
int n;
vector<LL> v;
void init(int _n)
{
n = _n;
v.assign(n, 0);
}
void upd(int i, int x)
{
for (; i < n; i |= (i + 1))
v[i] += x;
}
LL query(int i)
{
LL res = 0;
for (; i >= 0; i = (i & (i + 1)) - 1)
res += v[i];
return res;
}
};
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
FOR(i, 0, 4)
{
cin >> p[i];
p[i]--;
}
FOR(i, 0, n)
{
cin >> a[i];
a[i]--;
}
if (p[0] > 1)
{
FOR(i, 0, 4)
p[i] = 3 - p[i];
FOR(i, 0, n)
a[i] = n - 1 - a[i];
}
FOR(i, 0, n)
prefSum[i + 1][a[i] + 1] = 1;
FOR(i, 1, n + 1)
FOR(j, 1, n + 1)
prefSum[i][j] += prefSum[i][j - 1];
FOR(j, 1, n + 1)
FOR(i, 1, n + 1)
prefSum[i][j] += prefSum[i - 1][j];
FOR(i, 0, 4)
q[p[i]] = i;
if (solve(1, 2, 0, 3))
return 0;
if (solve(1, 3, 0, 2))
return 0;
if (solve(0, 2, 1, 3))
return 0;
assert(p[0] == 1 && p[1] == 3 && p[2] == 0 && p[3] == 2);
VI indices(n);
iota(ALL(indices), 0);
sort(ALL(indices), [&](int i, int j) {return a[i] > a[j];});
Fenwick fwCnt, fwSum;
FOR(i, 0, n)
{
VI cnt(n);
FOR(j, i + 1, n)
{
if (a[j] < a[i])
{
cnt[i + 1]++;
cnt[j]--;
}
}
FOR(j, 1, n)
cnt[j] += cnt[j - 1];
fwCnt.init(n);
fwSum.init(n);
for (int j : indices)
{
if (j > i && a[j] > a[i])
{
ans += fwSum.query(j) - fwCnt.query(j) * cnt[j];
fwCnt.upd(j, 1);
fwSum.upd(j, cnt[j]);
}
}
}
cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
5 1 2 3 4 1 2 3 4 5
output:
5
result:
ok 1 number(s): "5"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
8 1 3 2 4 1 2 5 6 3 4 7 8
output:
16
result:
ok 1 number(s): "16"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 1 2 3 4 1
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
10 1 2 3 4 1 4 6 9 8 5 3 7 10 2
output:
18
result:
ok 1 number(s): "18"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
10 1 2 4 3 3 5 1 6 4 7 8 9 10 2
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
10 1 3 2 4 8 3 9 1 2 7 10 6 5 4
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10 1 3 4 2 6 5 8 4 9 1 10 2 7 3
output:
7
result:
ok 1 number(s): "7"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
10 1 4 2 3 5 2 3 8 1 7 10 6 9 4
output:
4
result:
ok 1 number(s): "4"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
10 1 4 3 2 9 2 4 1 5 10 7 3 6 8
output:
6
result:
ok 1 number(s): "6"
Test #10:
score: 0
Accepted
time: 1ms
memory: 5588kb
input:
10 2 1 3 4 1 6 2 3 9 10 4 8 5 7
output:
2
result:
ok 1 number(s): "2"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
10 2 1 4 3 5 8 2 10 6 4 9 3 7 1
output:
7
result:
ok 1 number(s): "7"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 2 3 1 4 4 9 8 10 5 6 7 3 2 1
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
10 2 3 4 1 7 2 6 10 8 1 3 4 5 9
output:
2
result:
ok 1 number(s): "2"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 2 4 1 3 5 7 2 4 10 8 3 1 6 9
output:
22
result:
ok 1 number(s): "22"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10 2 4 3 1 1 7 4 3 10 5 6 9 8 2
output:
15
result:
ok 1 number(s): "15"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
10 3 1 2 4 9 8 7 1 10 2 4 5 3 6
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
10 3 1 4 2 5 4 2 10 9 6 3 7 1 8
output:
6
result:
ok 1 number(s): "6"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
10 3 2 1 4 4 3 7 10 8 2 9 5 6 1
output:
3
result:
ok 1 number(s): "3"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
10 3 2 4 1 4 9 3 10 1 5 8 6 2 7
output:
7
result:
ok 1 number(s): "7"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
10 3 4 1 2 8 10 9 4 7 6 5 3 1 2
output:
11
result:
ok 1 number(s): "11"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10 3 4 2 1 6 10 8 5 7 1 9 4 2 3
output:
24
result:
ok 1 number(s): "24"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
10 4 1 2 3 10 3 4 8 2 5 6 7 9 1
output:
33
result:
ok 1 number(s): "33"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
10 4 1 3 2 10 4 5 9 7 8 3 1 2 6
output:
10
result:
ok 1 number(s): "10"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 4 2 1 3 4 10 2 7 3 6 5 1 9 8
output:
18
result:
ok 1 number(s): "18"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 4 2 3 1 2 10 6 9 7 5 1 4 8 3
output:
15
result:
ok 1 number(s): "15"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10 4 3 1 2 2 10 3 6 9 8 1 4 7 5
output:
18
result:
ok 1 number(s): "18"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
10 4 3 2 1 6 5 4 7 1 3 8 2 9 10
output:
6
result:
ok 1 number(s): "6"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
20 1 2 3 4 5 13 20 14 1 19 10 3 4 7 11 12 18 6 16 17 15 8 9 2
output:
199
result:
ok 1 number(s): "199"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
20 1 2 4 3 17 13 19 8 7 14 10 20 6 4 3 15 2 18 16 11 9 1 5 12
output:
44
result:
ok 1 number(s): "44"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
20 1 3 2 4 15 19 13 11 9 8 10 7 2 1 14 20 4 6 12 18 3 16 5 17
output:
63
result:
ok 1 number(s): "63"
Test #31:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
20 1 3 4 2 16 19 13 6 12 10 9 8 7 3 5 1 15 17 14 11 20 4 18 2
output:
47
result:
ok 1 number(s): "47"
Test #32:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
20 1 4 2 3 16 20 14 18 5 10 6 17 11 4 8 3 2 13 12 9 7 1 15 19
output:
35
result:
ok 1 number(s): "35"
Test #33:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
20 1 4 3 2 4 19 9 13 18 20 7 3 8 17 2 11 10 15 12 6 5 1 16 14
output:
212
result:
ok 1 number(s): "212"
Test #34:
score: 0
Accepted
time: 0ms
memory: 5556kb
input:
20 2 1 3 4 19 2 16 17 8 3 18 6 5 14 20 4 10 12 13 11 15 9 7 1
output:
69
result:
ok 1 number(s): "69"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
20 2 1 4 3 19 3 4 16 13 6 12 1 18 11 2 8 5 14 17 20 15 9 7 10
output:
211
result:
ok 1 number(s): "211"
Test #36:
score: 0
Accepted
time: 1ms
memory: 5680kb
input:
20 2 3 1 4 19 3 14 16 15 4 13 8 5 18 12 7 11 10 2 9 17 6 1 20
output:
229
result:
ok 1 number(s): "229"
Test #37:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
20 2 3 4 1 19 8 12 11 20 9 14 4 6 15 17 18 1 13 5 3 2 10 7 16
output:
285
result:
ok 1 number(s): "285"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
20 2 4 1 3 10 14 11 1 5 7 8 6 3 13 12 15 16 17 18 4 19 9 2 20
output:
36
result:
ok 1 number(s): "36"
Test #39:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
20 2 4 3 1 8 15 6 20 9 14 12 4 3 10 11 7 13 16 2 18 19 17 1 5
output:
255
result:
ok 1 number(s): "255"
Test #40:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
20 3 1 2 4 3 8 1 6 4 7 5 11 20 17 2 12 13 16 10 15 19 18 14 9
output:
142
result:
ok 1 number(s): "142"
Test #41:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
20 3 1 4 2 9 18 15 12 4 7 1 10 6 2 8 17 14 20 16 19 11 3 5 13
output:
314
result:
ok 1 number(s): "314"
Test #42:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
20 3 2 1 4 13 5 18 3 9 17 7 10 2 1 6 12 19 4 15 16 8 20 11 14
output:
289
result:
ok 1 number(s): "289"
Test #43:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
20 3 2 4 1 16 4 20 6 18 7 9 10 11 8 2 1 19 12 14 13 17 15 3 5
output:
92
result:
ok 1 number(s): "92"
Test #44:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
20 3 4 1 2 16 17 1 3 6 11 18 20 12 14 2 5 19 7 8 15 13 10 9 4
output:
330
result:
ok 1 number(s): "330"
Test #45:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
20 3 4 2 1 7 16 11 9 12 15 10 18 4 1 8 20 17 3 5 13 6 2 14 19
output:
266
result:
ok 1 number(s): "266"
Test #46:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
20 4 1 2 3 7 15 16 4 8 3 10 1 5 18 9 19 2 13 17 6 20 12 11 14
output:
238
result:
ok 1 number(s): "238"
Test #47:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
20 4 1 3 2 3 20 16 1 10 6 15 7 17 5 8 19 4 11 14 13 2 9 18 12
output:
304
result:
ok 1 number(s): "304"
Test #48:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
20 4 2 1 3 7 18 12 19 17 15 9 10 6 1 20 8 14 5 13 3 2 4 16 11
output:
416
result:
ok 1 number(s): "416"
Test #49:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
20 4 2 3 1 4 9 1 19 16 13 17 2 6 15 7 12 10 8 20 5 11 14 18 3
output:
182
result:
ok 1 number(s): "182"
Test #50:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
20 4 3 1 2 17 1 19 12 16 18 15 2 5 4 9 11 8 13 10 6 7 14 3 20
output:
376
result:
ok 1 number(s): "376"
Test #51:
score: 0
Accepted
time: 0ms
memory: 5704kb
input:
20 4 3 2 1 11 1 19 4 20 16 18 12 8 14 7 15 5 6 9 3 2 13 17 10
output:
430
result:
ok 1 number(s): "430"
Test #52:
score: 0
Accepted
time: 0ms
memory: 5784kb
input:
50 1 2 3 4 45 23 50 43 29 4 11 38 41 48 16 35 47 15 37 19 10 26 33 46 18 20 14 36 1 12 39 42 5 13 28 6 32 17 44 30 25 7 8 9 21 24 22 3 27 34 2 31 40 49
output:
6877
result:
ok 1 number(s): "6877"
Test #53:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
50 1 2 4 3 44 7 23 46 4 14 43 48 20 13 18 49 38 36 50 19 11 21 27 1 10 3 35 45 40 26 34 29 42 30 2 24 31 22 47 9 15 5 32 39 41 37 6 12 17 28 8 33 16 25
output:
8769
result:
ok 1 number(s): "8769"
Test #54:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
50 1 3 2 4 11 43 31 4 10 48 2 26 45 8 14 22 28 20 30 19 17 5 38 37 27 18 39 16 24 50 23 25 33 42 41 47 15 44 9 13 36 3 12 40 46 29 1 35 6 32 7 21 34 49
output:
13762
result:
ok 1 number(s): "13762"
Test #55:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
50 1 3 4 2 31 12 10 48 43 22 28 11 4 29 39 7 16 40 1 26 21 33 18 14 30 41 35 9 46 19 3 8 47 13 2 15 37 49 27 25 20 50 36 6 23 24 32 44 34 38 42 5 17 45
output:
9737
result:
ok 1 number(s): "9737"
Test #56:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
50 1 4 2 3 2 48 20 29 21 30 33 24 46 44 32 41 17 27 19 28 36 18 7 14 22 26 45 37 47 11 31 23 5 42 38 34 12 35 13 9 40 16 25 8 4 3 39 6 10 43 1 49 15 50
output:
5394
result:
ok 1 number(s): "5394"
Test #57:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
50 1 4 3 2 18 41 7 26 2 25 49 45 9 35 12 50 30 22 19 48 23 32 16 4 6 47 5 10 31 1 14 33 3 34 42 13 29 24 39 17 38 37 46 8 11 15 40 44 20 28 21 27 36 43
output:
9523
result:
ok 1 number(s): "9523"
Test #58:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
50 2 1 3 4 17 5 34 8 38 25 43 7 22 44 24 20 48 11 19 16 33 27 47 31 49 29 2 50 6 40 30 37 46 42 3 15 39 41 1 26 9 45 13 10 18 23 12 14 21 4 28 36 35 32
output:
6729
result:
ok 1 number(s): "6729"
Test #59:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
50 2 1 4 3 2 34 36 37 33 8 15 24 40 43 48 30 28 46 47 16 29 31 44 7 26 13 45 41 4 12 1 23 20 49 42 35 18 22 14 50 25 3 11 27 5 39 38 6 10 21 19 9 32 17
output:
5896
result:
ok 1 number(s): "5896"
Test #60:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
50 2 3 1 4 45 25 26 32 1 24 8 6 48 10 2 47 31 43 7 38 41 39 17 13 35 28 40 18 21 14 33 3 27 4 5 42 15 9 20 34 12 11 30 19 22 37 49 46 16 36 29 44 23 50
output:
10609
result:
ok 1 number(s): "10609"
Test #61:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
50 2 3 4 1 8 16 49 7 3 29 48 37 15 32 50 12 21 27 33 39 43 6 44 14 9 38 18 4 25 19 1 46 2 24 45 35 42 23 47 22 34 40 28 10 20 11 13 5 26 17 36 41 30 31
output:
7426
result:
ok 1 number(s): "7426"
Test #62:
score: 0
Accepted
time: 1ms
memory: 5824kb
input:
50 2 4 1 3 21 16 22 23 47 29 17 18 36 9 39 41 32 38 49 46 7 14 35 13 50 19 2 6 4 42 27 25 44 40 11 45 20 15 3 31 10 28 1 33 24 34 37 12 5 26 43 8 30 48
output:
15337
result:
ok 1 number(s): "15337"
Test #63:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
50 2 4 3 1 29 41 16 40 23 31 28 1 39 24 25 14 21 2 36 13 45 37 38 20 30 12 3 34 5 18 47 15 49 35 11 8 50 26 48 9 22 33 44 4 27 19 43 17 6 46 42 10 7 32
output:
9274
result:
ok 1 number(s): "9274"
Test #64:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
50 3 1 2 4 21 45 17 43 36 30 33 6 37 4 22 9 11 14 24 15 28 35 40 16 2 18 34 47 38 1 20 42 44 26 27 5 48 41 39 46 25 49 10 12 23 13 31 8 50 3 29 7 32 19
output:
10743
result:
ok 1 number(s): "10743"
Test #65:
score: 0
Accepted
time: 1ms
memory: 5828kb
input:
50 3 1 4 2 23 49 13 9 22 8 50 15 20 28 36 1 24 26 2 14 16 10 4 46 47 37 7 41 5 6 17 21 42 34 48 32 39 31 33 29 27 3 44 19 18 35 25 12 38 30 11 45 40 43
output:
7905
result:
ok 1 number(s): "7905"
Test #66:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
50 3 2 1 4 36 19 12 46 44 35 14 8 45 43 9 3 37 20 41 49 47 50 7 39 21 11 10 2 27 22 30 42 48 16 26 29 5 4 32 23 38 1 28 17 18 31 24 25 6 13 15 34 40 33
output:
5500
result:
ok 1 number(s): "5500"
Test #67:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
50 3 2 4 1 19 34 7 13 41 43 6 24 21 17 30 32 28 47 22 2 35 39 23 15 9 1 31 12 49 10 48 11 42 50 40 4 16 26 46 27 36 44 45 8 38 29 33 25 20 18 3 37 5 14
output:
11570
result:
ok 1 number(s): "11570"
Test #68:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
50 3 4 1 2 19 25 20 44 24 6 16 22 43 26 47 17 40 15 10 39 9 37 7 23 31 1 28 45 46 11 21 35 13 42 18 30 8 36 33 41 32 49 2 4 48 50 5 12 29 14 38 34 3 27
output:
9118
result:
ok 1 number(s): "9118"
Test #69:
score: 0
Accepted
time: 1ms
memory: 5584kb
input:
50 3 4 2 1 22 18 39 50 13 17 47 21 46 10 24 43 8 44 23 38 19 29 26 27 20 2 6 36 25 9 41 40 42 1 37 15 31 16 33 32 28 48 30 11 12 7 5 4 3 45 49 35 34 14
output:
11309
result:
ok 1 number(s): "11309"
Test #70:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
50 4 1 2 3 39 1 11 47 33 34 8 17 30 40 49 20 29 31 43 50 41 21 14 9 5 38 25 2 22 28 19 35 4 42 32 6 3 13 15 48 27 37 46 10 16 36 12 18 26 45 44 24 7 23
output:
10916
result:
ok 1 number(s): "10916"
Test #71:
score: 0
Accepted
time: 1ms
memory: 5756kb
input:
50 4 1 3 2 2 17 5 35 32 24 4 29 31 41 43 15 44 11 3 23 20 1 28 49 25 16 46 45 40 33 47 50 13 21 42 18 22 48 37 7 9 12 10 6 8 26 14 34 30 19 39 27 36 38
output:
6334
result:
ok 1 number(s): "6334"
Test #72:
score: 0
Accepted
time: 1ms
memory: 5764kb
input:
50 4 2 1 3 10 1 34 31 14 30 3 41 35 44 27 32 9 20 25 13 43 29 5 18 47 16 33 50 42 8 39 48 38 40 23 36 26 21 22 46 17 6 49 28 19 37 2 12 15 24 7 11 45 4
output:
4635
result:
ok 1 number(s): "4635"
Test #73:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
50 4 2 3 1 37 34 12 49 40 8 4 19 13 24 10 33 5 25 15 18 47 32 20 43 46 36 3 45 39 48 11 28 21 2 27 6 29 31 50 9 7 14 41 26 1 23 35 44 16 30 17 42 22 38
output:
8285
result:
ok 1 number(s): "8285"
Test #74:
score: 0
Accepted
time: 1ms
memory: 6064kb
input:
50 4 3 1 2 2 45 6 27 46 9 29 34 28 44 17 25 26 47 14 43 18 49 40 4 21 11 39 48 32 5 42 36 37 41 35 15 33 19 13 31 24 7 1 22 20 30 8 10 38 23 50 12 16 3
output:
13414
result:
ok 1 number(s): "13414"
Test #75:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
50 4 3 2 1 18 40 28 1 37 27 34 38 50 39 47 30 24 14 8 3 10 36 43 44 26 48 23 17 13 49 6 12 15 22 32 45 7 19 20 9 11 35 25 29 46 31 4 41 2 5 16 33 42 21
output:
12233
result:
ok 1 number(s): "12233"
Test #76:
score: 0
Accepted
time: 0ms
memory: 5808kb
input:
100 1 2 3 4 17 41 19 23 46 16 10 31 82 12 77 32 11 71 83 25 98 18 34 59 13 73 80 65 37 22 6 2 24 5 94 42 51 63 52 92 97 26 93 38 36 87 64 70 14 43 68 85 33 44 74 89 56 1 69 88 20 49 48 21 84 90 7 47 39 55 81 86 76 57 3 62 15 78 100 60 61 66 91 30 58 35 99 96 54 27 79 9 29 50 45 72 75 4 67 40 8 53 95...
output:
237136
result:
ok 1 number(s): "237136"
Test #77:
score: 0
Accepted
time: 0ms
memory: 5628kb
input:
100 1 2 4 3 54 69 72 78 62 28 20 30 43 2 39 97 83 64 10 74 38 48 26 16 76 60 27 12 86 65 45 94 49 51 52 57 41 63 90 4 70 5 95 93 31 92 36 73 7 19 8 50 58 71 11 96 55 44 9 21 1 22 75 23 98 79 87 25 40 29 99 82 18 15 32 68 14 88 89 35 46 33 53 84 66 80 6 56 47 34 91 67 42 77 3 81 61 24 85 59 100 17 37...
output:
154093
result:
ok 1 number(s): "154093"
Test #78:
score: 0
Accepted
time: 1ms
memory: 4032kb
input:
100 1 3 2 4 31 19 7 88 14 2 9 98 73 89 44 45 10 55 83 84 11 69 96 46 59 30 38 41 56 68 75 79 70 85 66 42 80 81 57 47 49 62 6 78 34 60 93 82 71 90 18 64 76 4 99 94 97 40 17 33 36 77 91 35 54 23 32 3 29 100 58 8 67 37 43 1 39 24 87 12 72 16 65 27 63 25 13 48 5 28 86 95 50 53 20 61 21 51 74 22 15 92 52...
output:
146573
result:
ok 1 number(s): "146573"
Test #79:
score: 0
Accepted
time: 0ms
memory: 6128kb
input:
100 1 3 4 2 87 49 77 7 36 3 39 16 81 46 25 22 13 48 54 83 55 10 90 66 88 82 57 72 9 2 24 97 65 32 86 6 89 69 99 67 35 61 14 71 33 45 93 19 95 80 75 79 21 68 41 98 59 43 23 51 40 1 58 27 31 28 53 11 92 37 91 8 20 44 34 5 15 30 94 60 12 42 84 52 62 96 17 56 70 73 76 100 47 64 18 74 4 78 29 50 38 26 63...
output:
185066
result:
ok 1 number(s): "185066"
Test #80:
score: 0
Accepted
time: 1ms
memory: 4240kb
input:
100 1 4 2 3 20 95 33 41 94 61 72 47 29 66 44 80 85 12 84 7 83 26 99 60 87 58 53 18 31 70 45 77 25 34 92 55 78 42 63 71 40 67 88 62 32 52 98 93 5 3 1 14 43 96 69 74 64 56 9 89 100 54 23 6 22 46 16 2 36 57 79 10 97 59 35 24 21 86 91 19 76 50 82 48 81 90 11 75 30 38 8 37 4 15 13 65 51 68 28 39 73 17 27...
output:
126405
result:
ok 1 number(s): "126405"
Test #81:
score: 0
Accepted
time: 1ms
memory: 6032kb
input:
100 1 4 3 2 36 38 99 85 47 20 35 79 18 52 53 62 3 57 7 4 96 73 83 56 31 11 64 49 9 48 22 94 68 86 71 5 65 87 75 41 33 19 60 74 51 26 14 97 93 72 45 12 46 95 13 16 32 59 25 76 88 44 17 27 55 28 61 6 66 42 69 34 78 8 39 37 81 30 63 58 1 43 100 67 70 80 23 91 29 21 98 92 2 15 24 82 50 54 77 10 40 84 90...
output:
140801
result:
ok 1 number(s): "140801"
Test #82:
score: 0
Accepted
time: 1ms
memory: 5984kb
input:
100 2 1 3 4 91 92 11 30 28 52 95 76 9 21 70 8 89 84 10 37 83 39 97 16 18 2 27 48 58 78 74 72 15 44 7 4 98 45 63 29 55 49 31 13 17 56 32 14 62 93 24 100 12 6 20 94 79 66 22 19 73 67 25 3 57 42 54 60 5 90 64 53 23 80 40 59 34 88 77 46 47 41 26 96 1 65 43 69 51 99 38 36 33 71 61 75 87 68 50 86 35 82 85...
output:
226087
result:
ok 1 number(s): "226087"
Test #83:
score: 0
Accepted
time: 1ms
memory: 5800kb
input:
100 2 1 4 3 52 58 4 15 25 73 35 68 91 82 30 18 6 74 70 96 41 60 83 77 13 75 32 20 12 1 26 64 37 61 27 24 84 34 80 86 89 31 90 53 17 54 66 43 57 93 46 29 56 45 3 33 55 5 22 95 47 10 92 97 16 78 42 23 63 9 87 88 21 100 85 7 79 62 94 19 44 98 2 65 11 8 50 36 38 76 72 51 14 81 40 69 49 48 59 39 67 71 28...
output:
182696
result:
ok 1 number(s): "182696"
Test #84:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
100 2 3 1 4 55 74 3 76 94 69 70 28 23 6 67 16 95 79 81 43 19 91 13 83 52 26 36 98 92 17 7 58 59 44 68 40 63 66 97 33 60 65 100 27 34 75 77 73 8 32 93 38 57 90 45 84 41 99 15 2 71 21 61 89 46 12 85 42 37 4 49 82 9 53 54 14 22 25 47 51 29 48 96 80 56 50 78 11 64 88 86 39 20 72 35 30 62 24 10 87 5 1 31...
output:
111195
result:
ok 1 number(s): "111195"
Test #85:
score: 0
Accepted
time: 1ms
memory: 4236kb
input:
100 2 3 4 1 39 59 55 60 87 81 6 5 31 97 33 9 67 80 98 72 52 28 62 15 83 69 90 13 38 91 61 94 35 36 2 84 79 48 86 57 56 99 47 44 25 8 21 34 50 96 14 53 43 93 11 22 71 85 78 29 23 32 54 26 100 49 74 63 41 73 77 58 66 70 45 19 16 37 30 3 46 68 64 12 40 92 89 76 24 1 20 18 10 4 51 17 42 27 7 82 75 88 65...
output:
160879
result:
ok 1 number(s): "160879"
Test #86:
score: 0
Accepted
time: 1ms
memory: 4220kb
input:
100 2 4 1 3 25 21 76 23 10 71 6 72 34 1 31 79 62 48 13 65 56 61 47 92 100 54 63 84 14 33 26 94 22 16 30 52 96 2 36 42 83 57 38 40 82 87 51 67 91 43 11 78 85 75 58 9 90 93 24 77 86 3 7 8 41 35 73 50 28 20 37 17 98 64 70 66 74 27 4 59 32 60 18 95 69 97 49 55 68 12 39 81 46 29 15 88 45 80 44 89 19 53 5...
output:
173320
result:
ok 1 number(s): "173320"
Test #87:
score: 0
Accepted
time: 1ms
memory: 5952kb
input:
100 2 4 3 1 49 4 77 84 99 24 60 53 8 17 81 48 86 33 40 98 75 44 82 50 23 21 63 35 36 92 58 15 73 3 76 79 27 13 59 95 42 88 56 85 71 57 30 11 67 39 72 16 5 2 94 52 91 18 93 32 97 7 25 74 12 87 46 90 66 47 31 38 70 43 34 62 54 80 19 1 10 26 20 45 6 37 14 68 64 51 61 83 9 100 41 28 29 22 69 96 89 65 78...
output:
151561
result:
ok 1 number(s): "151561"
Test #88:
score: 0
Accepted
time: 1ms
memory: 6192kb
input:
100 3 1 2 4 3 29 70 31 9 6 80 59 15 51 64 100 72 26 61 27 20 62 65 28 63 25 84 10 23 77 44 68 57 2 43 97 37 8 35 54 90 30 41 83 78 55 36 12 56 5 74 38 53 21 73 17 48 66 93 88 32 42 22 98 34 91 96 67 18 58 4 81 16 33 45 69 49 52 94 82 79 11 60 89 19 71 92 14 50 40 76 99 46 75 7 24 1 87 86 39 85 13 95...
output:
184725
result:
ok 1 number(s): "184725"
Test #89:
score: 0
Accepted
time: 1ms
memory: 6004kb
input:
100 3 1 4 2 28 20 55 94 75 51 98 39 47 90 21 56 74 89 8 38 79 27 25 86 65 63 85 49 29 3 76 24 69 41 96 71 22 16 43 59 46 53 7 35 83 95 84 50 64 44 13 37 92 77 68 80 30 82 32 93 23 19 81 9 60 48 36 61 67 70 45 72 15 91 6 99 97 34 2 12 78 42 57 10 100 52 11 66 58 26 87 73 4 14 54 62 40 5 33 31 88 1 17...
output:
153851
result:
ok 1 number(s): "153851"
Test #90:
score: 0
Accepted
time: 1ms
memory: 6044kb
input:
100 3 2 1 4 30 26 100 6 60 50 68 17 59 9 15 34 61 85 92 64 80 56 25 62 90 84 28 2 75 53 44 94 3 82 10 49 1 81 72 31 89 73 52 13 38 83 42 40 69 14 12 97 27 54 98 11 18 76 47 99 93 70 32 55 33 86 48 22 46 7 67 20 39 58 36 35 77 74 8 45 43 66 91 19 78 21 24 63 16 57 65 51 79 87 4 37 29 96 71 95 41 5 23...
output:
156202
result:
ok 1 number(s): "156202"
Test #91:
score: 0
Accepted
time: 1ms
memory: 5968kb
input:
100 3 2 4 1 33 47 54 39 85 76 82 57 40 26 35 46 41 53 29 32 72 77 86 48 88 66 97 60 10 81 38 37 16 80 2 28 87 23 20 45 44 59 18 99 84 98 19 42 5 49 17 95 27 64 94 15 11 62 30 3 79 22 6 93 96 74 21 36 8 63 50 75 4 78 65 100 51 70 1 9 67 14 55 68 58 52 43 90 7 34 91 13 69 83 12 25 73 31 24 89 71 61 56...
output:
182903
result:
ok 1 number(s): "182903"
Test #92:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
100 3 4 1 2 81 53 58 95 90 56 14 69 29 61 66 15 75 45 25 20 8 48 37 67 84 63 79 99 73 28 9 96 5 50 10 30 38 76 32 3 21 88 4 36 22 83 77 43 27 87 19 34 74 39 31 44 52 68 70 72 11 71 57 1 93 55 35 97 82 59 64 49 6 33 41 18 65 13 94 80 60 92 62 26 24 85 46 89 7 98 47 42 51 2 17 12 86 100 91 78 16 54 40...
output:
158532
result:
ok 1 number(s): "158532"
Test #93:
score: 0
Accepted
time: 0ms
memory: 5604kb
input:
100 3 4 2 1 38 66 5 29 27 1 18 99 68 13 33 14 91 36 17 48 54 89 49 2 67 63 24 69 86 65 8 39 30 58 11 98 75 41 78 74 12 72 97 84 80 47 92 45 23 26 73 16 28 52 31 35 95 71 64 88 25 3 42 9 93 76 100 46 77 87 90 21 10 32 51 94 85 44 7 57 55 19 20 50 70 79 82 43 81 34 60 62 22 4 56 96 59 40 6 83 61 37 15...
output:
145028
result:
ok 1 number(s): "145028"
Test #94:
score: 0
Accepted
time: 1ms
memory: 4024kb
input:
100 4 1 2 3 75 94 50 11 72 58 61 26 92 95 22 73 77 97 39 2 1 82 15 36 40 63 54 74 64 5 62 65 55 60 14 6 68 4 56 24 18 27 51 90 89 17 57 32 83 35 21 25 81 88 9 47 46 80 45 10 66 7 96 84 38 93 13 85 16 43 86 49 19 67 78 20 59 34 91 31 98 33 87 37 71 52 12 48 100 42 29 3 69 70 99 23 79 44 53 8 76 30 28...
output:
192554
result:
ok 1 number(s): "192554"
Test #95:
score: 0
Accepted
time: 1ms
memory: 6200kb
input:
100 4 1 3 2 56 16 79 87 4 1 21 32 27 36 74 44 39 52 50 26 13 24 80 75 33 63 20 86 94 96 10 78 2 65 25 9 58 73 77 61 31 12 84 81 49 76 3 70 71 83 57 30 60 47 90 45 40 100 97 68 69 62 55 72 37 95 93 89 54 92 98 11 41 59 29 64 14 18 99 67 51 82 43 8 7 48 91 42 19 17 22 38 5 53 66 46 28 23 35 6 85 88 15...
output:
136968
result:
ok 1 number(s): "136968"
Test #96:
score: 0
Accepted
time: 0ms
memory: 5760kb
input:
100 4 2 1 3 40 43 95 26 31 98 67 86 68 30 60 82 38 41 51 88 70 33 9 59 15 48 90 24 61 35 3 52 99 5 54 10 44 78 94 22 14 1 8 89 76 100 96 80 23 74 62 93 85 92 81 4 32 55 11 91 58 87 34 50 97 84 29 69 49 79 46 47 12 18 36 7 64 20 77 57 63 2 37 72 13 65 56 83 73 17 39 53 21 6 28 66 27 42 75 16 19 71 45...
output:
168268
result:
ok 1 number(s): "168268"
Test #97:
score: 0
Accepted
time: 0ms
memory: 6012kb
input:
100 4 2 3 1 71 55 63 53 47 41 33 9 70 96 69 39 99 65 40 92 30 62 64 48 24 77 50 52 49 81 72 16 57 60 28 79 88 90 25 97 35 54 66 11 85 44 2 46 13 75 43 6 93 86 98 59 19 61 95 34 80 42 94 5 56 14 31 100 45 36 3 76 82 78 87 29 18 68 12 8 32 67 15 17 21 51 38 7 84 22 73 74 83 58 89 4 27 23 37 10 20 1 26...
output:
213636
result:
ok 1 number(s): "213636"
Test #98:
score: 0
Accepted
time: 0ms
memory: 5928kb
input:
100 4 3 1 2 30 70 63 87 3 5 90 44 11 10 9 95 4 86 1 65 81 48 17 76 92 80 61 18 38 35 69 46 66 40 31 85 100 49 50 73 41 39 25 37 96 34 8 52 77 32 82 15 60 93 88 79 43 64 16 94 6 47 29 84 2 26 36 53 83 75 71 14 67 58 20 91 24 56 33 74 97 78 45 23 55 13 72 12 57 22 89 62 19 7 27 59 42 68 98 99 54 28 21...
output:
167099
result:
ok 1 number(s): "167099"
Test #99:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
100 4 3 2 1 20 35 63 19 12 70 37 74 96 21 7 68 8 54 17 48 87 66 16 62 89 23 85 64 82 56 31 41 67 29 38 72 53 75 78 42 58 11 52 4 18 98 69 39 9 50 49 76 43 47 93 97 59 15 100 86 55 73 10 95 6 57 83 24 33 27 80 46 88 90 32 79 22 81 3 30 40 13 92 99 91 34 71 51 25 2 65 77 5 28 14 26 45 84 36 60 61 44 9...
output:
151773
result:
ok 1 number(s): "151773"
Test #100:
score: 0
Accepted
time: 3ms
memory: 12220kb
input:
500 1 2 3 4 12 400 30 131 356 122 74 297 387 396 84 219 487 292 371 83 38 304 149 308 10 177 225 72 181 113 140 440 110 82 349 201 86 208 148 146 16 325 175 458 379 43 144 425 200 274 90 61 121 301 31 204 247 39 100 338 245 278 211 185 69 352 108 447 64 128 73 238 434 34 284 37 162 198 4 137 312 470...
output:
136360328
result:
ok 1 number(s): "136360328"
Test #101:
score: 0
Accepted
time: 7ms
memory: 12072kb
input:
500 1 2 4 3 206 237 145 138 263 266 428 170 164 334 33 236 443 217 278 325 347 229 319 48 136 465 399 410 70 108 181 320 423 408 260 101 292 244 104 448 117 340 282 243 390 419 306 6 40 366 324 190 472 374 131 180 473 405 322 280 295 90 119 185 412 403 421 174 112 269 450 444 474 454 43 314 379 258 ...
output:
94960067
result:
ok 1 number(s): "94960067"
Test #102:
score: 0
Accepted
time: 3ms
memory: 12400kb
input:
500 1 3 2 4 78 408 332 249 268 43 135 176 67 484 282 494 9 406 123 148 381 453 83 182 207 400 328 216 183 201 57 350 461 367 90 194 42 137 477 171 414 198 388 279 302 144 396 112 500 142 286 451 346 475 292 326 370 27 250 245 416 180 186 66 273 172 402 397 82 352 158 431 434 170 46 465 109 203 56 44...
output:
106792220
result:
ok 1 number(s): "106792220"
Test #103:
score: 0
Accepted
time: 7ms
memory: 12260kb
input:
500 1 3 4 2 419 492 121 265 332 497 302 285 206 463 447 351 430 284 472 132 490 125 7 83 386 464 360 200 440 138 466 270 368 264 397 166 71 410 376 4 129 336 190 458 81 155 338 393 378 353 145 308 144 66 49 392 54 443 26 92 85 185 276 124 106 452 153 196 2 136 266 434 224 292 41 137 281 9 288 438 17...
output:
108704905
result:
ok 1 number(s): "108704905"
Test #104:
score: 0
Accepted
time: 6ms
memory: 12020kb
input:
500 1 4 2 3 198 364 291 422 54 135 352 363 229 35 24 345 498 134 478 499 376 180 181 201 258 103 496 277 63 150 493 110 420 153 233 81 351 33 494 300 190 433 237 173 188 73 424 371 3 457 329 85 200 248 122 50 487 245 141 327 213 394 217 463 357 159 271 10 5 434 486 476 311 205 46 124 326 145 483 396...
output:
108330407
result:
ok 1 number(s): "108330407"
Test #105:
score: 0
Accepted
time: 6ms
memory: 12632kb
input:
500 1 4 3 2 386 175 27 495 57 309 329 114 441 500 61 271 53 129 89 206 446 398 456 469 346 315 106 382 124 237 295 101 314 183 194 108 116 319 462 225 280 372 163 311 268 444 485 443 410 293 37 363 102 414 4 171 351 277 113 474 247 148 195 306 186 149 133 233 308 80 434 391 347 417 55 473 440 24 378...
output:
104544606
result:
ok 1 number(s): "104544606"
Test #106:
score: 0
Accepted
time: 3ms
memory: 12416kb
input:
500 2 1 3 4 173 470 8 97 164 109 214 415 107 305 352 319 122 400 225 202 217 77 158 306 440 111 25 192 227 55 390 406 232 234 180 275 236 104 23 389 377 211 138 399 269 259 313 62 204 12 354 256 41 94 395 200 19 82 461 182 479 254 381 468 26 169 460 28 170 434 283 258 453 286 368 360 183 287 499 308...
output:
137552114
result:
ok 1 number(s): "137552114"
Test #107:
score: 0
Accepted
time: 6ms
memory: 12268kb
input:
500 2 1 4 3 323 340 214 59 9 313 383 66 98 13 373 24 408 350 62 235 56 415 133 115 364 245 327 206 455 188 202 116 55 316 268 246 251 469 386 120 420 10 416 274 484 371 349 284 117 45 94 50 100 422 67 128 157 72 490 410 432 49 403 153 134 241 264 434 52 291 470 127 105 220 43 208 78 31 448 139 322 1...
output:
105474583
result:
ok 1 number(s): "105474583"
Test #108:
score: 0
Accepted
time: 7ms
memory: 12040kb
input:
500 2 3 1 4 40 316 479 148 142 264 20 227 497 483 238 45 85 452 421 416 190 21 146 356 254 300 394 83 204 221 281 206 298 194 242 128 492 213 96 164 72 195 482 322 57 29 180 156 212 340 22 16 250 159 235 382 261 200 423 6 249 27 471 296 140 290 222 496 434 124 123 405 440 361 144 202 371 64 105 342 ...
output:
112142515
result:
ok 1 number(s): "112142515"
Test #109:
score: 0
Accepted
time: 6ms
memory: 11796kb
input:
500 2 3 4 1 46 279 322 93 495 201 31 403 194 417 321 433 296 149 258 386 280 440 314 422 463 413 250 412 277 119 199 163 69 477 500 344 220 424 165 361 28 460 471 273 486 176 145 60 369 419 338 42 38 237 221 283 397 192 465 281 219 174 335 57 430 41 441 434 159 466 410 30 246 54 44 157 67 177 458 20...
output:
100303091
result:
ok 1 number(s): "100303091"
Test #110:
score: 0
Accepted
time: 4ms
memory: 12380kb
input:
500 2 4 1 3 420 202 2 467 180 5 282 444 298 20 231 59 486 34 29 389 270 211 229 194 162 226 79 377 117 491 429 115 48 183 237 217 281 411 189 35 370 160 95 190 482 303 167 242 166 308 227 257 209 196 131 192 289 335 489 89 15 168 325 440 241 332 402 161 487 252 37 369 490 267 96 206 365 415 372 435 ...
output:
106107402
result:
ok 1 number(s): "106107402"
Test #111:
score: 0
Accepted
time: 3ms
memory: 12200kb
input:
500 2 4 3 1 94 4 297 235 118 209 81 324 52 31 355 465 421 202 66 36 224 62 411 494 328 213 256 203 9 149 208 303 110 248 269 322 122 492 126 147 164 301 341 174 369 79 267 372 240 305 291 90 280 258 423 41 34 112 86 321 276 316 242 309 103 290 151 232 177 394 207 210 24 65 253 146 183 404 485 184 33...
output:
98859945
result:
ok 1 number(s): "98859945"
Test #112:
score: 0
Accepted
time: 7ms
memory: 10656kb
input:
500 3 1 2 4 306 360 356 411 500 232 331 147 37 309 490 152 369 395 481 284 269 3 325 34 219 261 20 94 230 138 22 76 316 105 257 441 295 169 93 390 224 410 235 195 140 156 323 189 60 458 179 32 234 327 185 265 210 314 168 31 123 435 346 65 468 160 117 308 100 44 456 19 337 143 47 238 378 106 133 263 ...
output:
93850536
result:
ok 1 number(s): "93850536"
Test #113:
score: 0
Accepted
time: 3ms
memory: 12224kb
input:
500 3 1 4 2 316 422 31 268 376 353 85 50 420 30 40 112 355 26 150 265 203 61 348 340 173 283 135 461 470 92 242 110 286 312 334 90 214 68 183 381 466 101 210 6 74 160 497 309 474 141 279 189 56 468 477 236 290 28 454 224 44 337 179 495 299 500 391 284 20 12 403 364 198 202 475 211 446 444 308 473 26...
output:
104271148
result:
ok 1 number(s): "104271148"
Test #114:
score: 0
Accepted
time: 6ms
memory: 12232kb
input:
500 3 2 1 4 323 448 292 135 273 431 112 169 389 72 196 111 37 241 141 377 7 149 186 101 41 26 457 403 475 170 474 97 451 113 493 435 293 103 247 96 152 342 93 450 264 271 125 226 34 489 337 410 205 198 119 223 95 484 439 100 275 21 481 405 6 32 455 173 191 299 163 77 256 137 402 179 400 307 155 224 ...
output:
103107749
result:
ok 1 number(s): "103107749"
Test #115:
score: 0
Accepted
time: 3ms
memory: 12440kb
input:
500 3 2 4 1 94 156 406 363 150 129 178 155 298 472 46 200 44 140 313 355 142 367 315 272 292 337 276 159 214 100 131 110 421 280 394 198 368 106 160 259 56 499 398 93 305 237 290 397 218 458 252 72 185 360 312 22 436 32 480 21 393 389 356 43 126 117 277 163 375 75 293 86 101 148 299 387 278 85 317 1...
output:
110499502
result:
ok 1 number(s): "110499502"
Test #116:
score: 0
Accepted
time: 3ms
memory: 12056kb
input:
500 3 4 1 2 144 60 352 126 453 435 284 158 423 414 397 175 198 49 30 420 113 405 54 432 142 263 40 94 273 500 66 137 12 278 357 254 48 164 229 491 362 77 268 220 93 459 56 439 354 41 161 150 490 29 464 140 26 71 282 483 478 498 129 13 410 374 155 298 297 153 9 355 349 436 5 193 294 274 363 43 399 33...
output:
110607461
result:
ok 1 number(s): "110607461"
Test #117:
score: 0
Accepted
time: 6ms
memory: 10684kb
input:
500 3 4 2 1 170 469 157 398 354 80 35 419 190 165 127 452 199 341 347 18 375 355 149 250 390 139 431 32 210 5 429 49 339 391 76 401 153 290 166 261 70 387 266 89 201 39 430 205 6 417 260 478 63 461 167 286 191 120 257 112 204 245 218 160 442 432 141 486 330 118 279 48 81 376 161 13 312 292 73 181 18...
output:
102821415
result:
ok 1 number(s): "102821415"
Test #118:
score: 0
Accepted
time: 3ms
memory: 12048kb
input:
500 4 1 2 3 135 220 277 113 379 103 418 352 377 496 42 11 348 486 53 371 462 422 25 312 78 188 133 413 433 330 361 222 402 268 6 141 439 223 366 193 388 201 362 385 60 191 334 471 256 497 230 88 307 31 425 138 167 108 12 322 20 76 224 117 15 90 479 428 400 442 341 412 29 355 390 472 406 368 295 41 4...
output:
111894660
result:
ok 1 number(s): "111894660"
Test #119:
score: 0
Accepted
time: 6ms
memory: 12536kb
input:
500 4 1 3 2 480 488 425 103 447 27 213 388 71 280 317 159 37 112 192 264 200 226 384 355 143 241 414 424 383 84 110 324 396 276 216 108 176 277 304 136 379 248 336 300 454 187 138 92 465 46 178 119 124 59 389 160 455 99 234 231 378 321 323 229 66 172 462 403 456 338 287 285 109 149 142 51 230 359 47...
output:
99530647
result:
ok 1 number(s): "99530647"
Test #120:
score: 0
Accepted
time: 6ms
memory: 12644kb
input:
500 4 2 1 3 375 54 489 199 298 17 323 398 351 31 257 145 46 320 38 246 19 103 356 478 312 9 120 75 357 34 205 272 310 452 18 314 455 402 78 242 26 240 486 477 71 220 133 340 90 57 426 13 377 37 12 232 111 316 258 304 95 261 400 175 445 136 161 286 281 206 416 467 392 371 365 45 177 247 58 160 79 39 ...
output:
101477009
result:
ok 1 number(s): "101477009"
Test #121:
score: 0
Accepted
time: 7ms
memory: 11968kb
input:
500 4 2 3 1 123 116 353 380 153 13 272 244 470 233 135 478 287 461 203 231 100 351 138 1 124 382 220 454 347 316 187 466 268 239 396 63 346 174 424 183 226 29 128 476 304 362 482 397 126 449 129 24 322 127 162 41 349 315 419 251 348 234 294 368 298 383 431 172 179 257 458 364 451 404 418 373 445 28 ...
output:
112332259
result:
ok 1 number(s): "112332259"
Test #122:
score: 0
Accepted
time: 3ms
memory: 12228kb
input:
500 4 3 1 2 218 111 235 16 473 82 263 352 388 341 397 392 109 6 495 386 195 176 149 83 19 62 69 264 389 33 487 78 142 338 400 234 328 8 170 41 130 364 351 77 418 239 425 441 66 5 182 299 243 138 49 290 46 318 453 390 116 247 115 238 181 193 445 475 354 167 65 171 10 332 254 252 58 470 197 99 278 276...
output:
98205212
result:
ok 1 number(s): "98205212"
Test #123:
score: 0
Accepted
time: 5ms
memory: 12104kb
input:
500 4 3 2 1 413 105 271 280 130 211 203 100 168 286 289 87 43 306 374 106 193 475 463 268 205 54 482 119 354 84 249 307 94 120 335 173 142 278 318 279 438 288 291 229 138 422 435 55 490 101 308 449 13 134 35 3 498 442 263 393 254 250 417 351 500 162 433 396 260 110 423 371 9 81 474 332 212 246 445 4...
output:
96460491
result:
ok 1 number(s): "96460491"
Test #124:
score: 0
Accepted
time: 16ms
memory: 20568kb
input:
1000 1 2 3 4 654 987 276 767 796 65 863 535 57 936 597 337 629 93 239 48 188 455 506 142 483 324 300 333 982 778 695 73 644 26 963 971 856 310 698 689 301 242 813 923 576 514 34 444 525 970 814 928 519 120 848 549 363 501 109 560 297 865 192 539 996 484 456 283 168 847 325 316 245 694 37 764 716 24 ...
output:
1708559671
result:
ok 1 number(s): "1708559671"
Test #125:
score: 0
Accepted
time: 17ms
memory: 21464kb
input:
1000 1 2 4 3 833 637 6 391 40 931 420 514 238 920 928 379 85 462 327 374 322 131 262 659 270 16 184 675 943 335 889 35 657 23 836 562 20 804 8 577 403 429 47 653 149 704 904 869 701 469 495 150 425 342 336 273 942 874 160 56 829 711 71 546 367 679 937 901 559 720 691 880 592 700 638 802 195 135 320 ...
output:
1724472011
result:
ok 1 number(s): "1724472011"
Test #126:
score: 0
Accepted
time: 19ms
memory: 20780kb
input:
1000 1 3 2 4 559 879 212 463 533 885 292 65 804 623 617 738 565 58 448 130 152 684 890 775 679 466 138 385 887 777 774 773 206 819 813 947 612 136 464 47 497 576 642 609 810 165 492 379 471 638 105 696 37 233 202 803 219 681 643 196 66 537 722 462 44 493 143 265 453 695 530 532 938 637 569 209 630 5...
output:
1607588336
result:
ok 1 number(s): "1607588336"
Test #127:
score: 0
Accepted
time: 21ms
memory: 20444kb
input:
1000 1 3 4 2 894 667 774 194 819 319 649 359 219 191 672 213 966 583 844 994 959 93 808 19 242 714 247 863 76 331 586 426 640 269 543 694 301 32 199 993 412 78 280 525 989 246 861 100 505 647 572 447 283 303 842 451 353 731 304 990 678 923 892 925 124 784 257 70 103 855 482 681 645 939 776 516 477 7...
output:
1731383584
result:
ok 1 number(s): "1731383584"
Test #128:
score: 0
Accepted
time: 19ms
memory: 21136kb
input:
1000 1 4 2 3 42 859 350 744 666 715 144 9 573 276 289 44 585 163 526 269 167 840 231 763 569 883 874 806 45 902 405 731 623 729 732 894 507 113 875 381 654 750 406 906 814 184 704 292 203 397 803 430 309 147 101 433 567 392 272 27 480 528 785 745 770 520 889 808 411 923 610 181 615 662 559 625 202 1...
output:
1664096766
result:
ok 1 number(s): "1664096766"
Test #129:
score: 0
Accepted
time: 22ms
memory: 20460kb
input:
1000 1 4 3 2 676 998 91 622 584 94 455 28 777 304 116 404 870 840 39 137 335 792 383 380 629 659 867 90 343 728 782 565 158 278 134 656 838 740 272 549 138 603 955 535 206 513 708 110 614 223 314 495 891 899 605 862 652 405 648 788 856 334 693 679 581 727 894 373 798 3 416 806 291 961 872 160 986 86...
output:
1704804356
result:
ok 1 number(s): "1704804356"
Test #130:
score: 0
Accepted
time: 19ms
memory: 20356kb
input:
1000 2 1 3 4 148 671 365 656 999 829 468 858 911 321 332 594 39 272 813 427 196 946 679 93 167 662 363 965 105 238 376 297 530 372 844 576 988 490 90 525 850 106 489 931 6 863 934 249 349 797 4 796 577 511 421 354 783 88 188 100 255 151 778 115 582 267 134 120 33 913 825 422 377 53 635 793 2 346 923...
output:
1835423097
result:
ok 1 number(s): "1835423097"
Test #131:
score: 0
Accepted
time: 22ms
memory: 20472kb
input:
1000 2 1 4 3 752 636 414 960 972 368 773 105 624 750 910 354 535 682 698 720 409 837 269 673 319 420 120 868 789 502 684 954 647 485 604 614 410 403 267 246 67 764 858 519 654 297 801 913 795 850 317 933 60 14 867 28 851 393 274 196 158 569 635 479 941 823 476 608 725 446 722 147 710 72 500 284 81 8...
output:
1798056856
result:
ok 1 number(s): "1798056856"
Test #132:
score: 0
Accepted
time: 19ms
memory: 20972kb
input:
1000 2 3 1 4 697 45 327 869 424 521 813 161 812 513 574 964 105 609 463 752 288 315 793 367 790 365 633 244 33 639 555 902 576 261 786 236 705 570 389 283 85 635 227 889 718 529 565 912 608 494 908 543 347 921 135 495 211 114 624 6 491 413 373 519 466 116 682 505 550 820 524 124 909 698 719 39 654 5...
output:
1719776188
result:
ok 1 number(s): "1719776188"
Test #133:
score: 0
Accepted
time: 23ms
memory: 20628kb
input:
1000 2 3 4 1 469 339 24 878 328 678 947 171 442 172 725 670 681 652 336 364 696 299 685 124 728 18 431 441 659 608 279 783 142 821 525 752 930 37 605 531 314 837 563 198 378 831 361 922 496 616 153 527 914 300 884 573 150 237 417 851 830 679 863 553 921 649 785 582 550 255 488 802 99 717 668 210 317...
output:
1765567001
result:
ok 1 number(s): "1765567001"
Test #134:
score: 0
Accepted
time: 7ms
memory: 20248kb
input:
1000 2 4 1 3 449 287 299 334 312 142 61 495 435 436 276 940 505 750 772 267 566 408 740 973 816 776 528 477 179 445 821 531 309 352 848 876 162 463 63 343 721 766 589 631 452 714 769 868 302 688 296 430 956 437 496 986 192 416 448 19 556 722 371 363 225 815 834 681 845 525 500 277 992 46 333 582 894...
output:
1779169877
result:
ok 1 number(s): "1779169877"
Test #135:
score: 0
Accepted
time: 19ms
memory: 19136kb
input:
1000 2 4 3 1 111 684 847 115 250 662 693 459 727 904 20 541 108 925 181 105 535 778 305 189 291 81 288 783 690 539 997 253 49 37 6 420 415 950 63 61 786 558 114 457 730 192 974 27 391 322 787 622 116 513 857 522 413 512 9 83 542 915 821 935 615 91 473 968 392 99 165 369 120 34 337 969 900 53 216 265...
output:
1649603967
result:
ok 1 number(s): "1649603967"
Test #136:
score: 0
Accepted
time: 19ms
memory: 21000kb
input:
1000 3 1 2 4 872 652 716 222 960 677 358 294 497 833 326 862 329 100 553 724 48 975 287 94 313 592 446 22 189 836 64 572 761 538 703 697 80 352 789 939 957 388 979 478 369 278 113 994 759 630 208 607 138 184 249 981 555 152 403 126 469 573 337 887 749 332 323 290 896 741 425 141 187 233 720 301 971 ...
output:
1708713122
result:
ok 1 number(s): "1708713122"
Test #137:
score: 0
Accepted
time: 7ms
memory: 21256kb
input:
1000 3 1 4 2 432 671 265 696 578 62 647 670 92 157 613 593 878 511 78 327 568 239 425 563 735 872 800 214 823 43 257 707 528 648 833 758 936 232 623 247 699 424 580 138 445 41 156 977 674 538 414 550 764 838 174 291 902 855 65 24 269 760 536 620 835 603 205 975 176 958 775 901 566 992 317 919 147 78...
output:
1837072778
result:
ok 1 number(s): "1837072778"
Test #138:
score: 0
Accepted
time: 18ms
memory: 19408kb
input:
1000 3 2 1 4 596 264 167 838 978 284 706 834 668 246 281 104 347 593 776 349 857 513 601 819 918 19 759 383 40 882 575 611 993 239 741 64 859 163 512 554 437 831 604 650 540 865 701 207 147 350 768 738 898 957 472 272 445 527 467 697 10 849 678 632 81 798 73 367 743 275 614 871 990 22 999 106 486 15...
output:
1771725071
result:
ok 1 number(s): "1771725071"
Test #139:
score: 0
Accepted
time: 18ms
memory: 20268kb
input:
1000 3 2 4 1 814 742 234 10 91 55 547 466 165 404 579 430 286 543 152 334 931 996 154 575 247 613 853 542 632 292 797 691 408 671 272 505 63 869 640 646 895 942 268 997 242 353 539 839 593 945 585 680 198 743 633 209 26 125 897 444 957 107 718 544 519 138 586 695 445 722 832 852 301 421 119 845 540 ...
output:
1818663235
result:
ok 1 number(s): "1818663235"
Test #140:
score: 0
Accepted
time: 22ms
memory: 20248kb
input:
1000 3 4 1 2 718 9 852 249 848 873 992 41 382 681 735 362 574 732 503 517 238 158 561 670 133 252 40 426 481 196 850 748 229 989 488 978 132 991 635 624 910 90 676 754 62 480 352 682 570 463 549 535 411 13 123 904 864 772 205 492 972 383 216 227 269 68 262 34 177 723 217 66 694 350 63 537 130 774 57...
output:
1729337823
result:
ok 1 number(s): "1729337823"
Test #141:
score: 0
Accepted
time: 20ms
memory: 20468kb
input:
1000 3 4 2 1 258 746 337 233 129 310 733 651 547 210 372 600 354 274 512 244 411 160 565 747 328 835 955 681 126 891 35 638 936 658 225 946 566 613 313 608 816 178 152 597 195 320 928 655 45 465 1000 213 643 93 778 378 674 932 67 934 557 647 176 88 149 861 292 860 281 750 400 445 448 299 844 151 98 ...
output:
1844064086
result:
ok 1 number(s): "1844064086"
Test #142:
score: 0
Accepted
time: 17ms
memory: 22064kb
input:
1000 4 1 2 3 635 499 951 488 112 113 932 449 175 978 649 573 128 362 571 279 608 892 768 546 720 937 163 437 657 628 806 376 51 322 618 165 631 952 30 290 788 506 327 374 69 658 779 962 862 785 352 555 982 72 808 122 864 967 61 820 968 977 244 102 830 83 392 522 347 885 190 496 406 775 271 405 326 3...
output:
1766123853
result:
ok 1 number(s): "1766123853"
Test #143:
score: 0
Accepted
time: 19ms
memory: 20980kb
input:
1000 4 1 3 2 348 405 377 330 859 630 453 992 298 419 483 583 266 851 773 164 553 753 858 271 404 6 273 717 841 591 320 134 762 568 694 317 820 708 901 382 143 126 493 737 173 482 42 736 878 906 5 941 484 2 610 857 852 997 562 293 124 69 468 539 454 135 964 470 870 57 677 172 9 730 806 888 231 74 7 7...
output:
1736636719
result:
ok 1 number(s): "1736636719"
Test #144:
score: 0
Accepted
time: 22ms
memory: 20992kb
input:
1000 4 2 1 3 541 571 150 591 715 20 389 129 390 648 44 61 324 580 320 953 773 9 75 167 226 156 558 811 575 625 392 928 636 47 96 700 888 19 66 101 107 35 132 999 214 352 140 229 817 843 978 815 748 164 742 482 498 973 113 965 755 567 42 118 553 254 799 693 489 745 160 117 297 739 774 360 714 170 612...
output:
1740767332
result:
ok 1 number(s): "1740767332"
Test #145:
score: 0
Accepted
time: 20ms
memory: 21188kb
input:
1000 4 2 3 1 510 457 464 219 458 253 70 617 46 754 568 844 378 628 271 697 981 101 631 630 804 59 402 481 421 462 405 762 289 1 231 940 862 537 64 266 685 431 107 254 800 643 306 892 573 223 705 634 524 86 153 321 183 343 55 470 597 390 557 604 269 261 814 308 164 879 799 934 127 515 210 633 222 842...
output:
1536477842
result:
ok 1 number(s): "1536477842"
Test #146:
score: 0
Accepted
time: 18ms
memory: 20912kb
input:
1000 4 3 1 2 371 555 987 512 408 738 174 76 202 645 593 747 14 102 875 758 437 988 179 935 380 667 47 729 254 322 410 725 761 835 571 730 131 205 485 520 468 765 46 266 15 263 832 464 348 122 22 286 910 700 208 560 843 908 675 210 413 676 237 99 228 983 20 518 732 848 441 333 559 799 265 462 776 404...
output:
1731442962
result:
ok 1 number(s): "1731442962"
Test #147:
score: 0
Accepted
time: 17ms
memory: 20940kb
input:
1000 4 3 2 1 432 254 70 382 559 905 417 447 651 876 562 969 50 808 605 649 693 467 436 241 383 939 341 27 5 49 204 328 118 927 932 371 996 549 229 77 484 584 710 787 372 603 941 173 433 574 391 544 930 747 802 497 400 302 854 346 419 700 123 368 262 61 38 901 490 182 552 650 912 66 704 502 60 162 16...
output:
1762008109
result:
ok 1 number(s): "1762008109"
Test #148:
score: 0
Accepted
time: 71ms
memory: 35640kb
input:
2000 1 2 3 4 1858 640 1245 838 218 202 832 1582 1202 1657 1001 609 1249 747 1169 1346 1241 291 369 772 1335 1150 272 1597 1574 1154 696 227 1629 1540 146 324 809 1671 1824 1601 1292 1873 572 1844 626 430 220 1962 298 1825 1375 1097 945 188 570 216 990 543 315 1353 1613 209 320 576 486 1414 753 1034 ...
output:
27061387553
result:
ok 1 number(s): "27061387553"
Test #149:
score: 0
Accepted
time: 74ms
memory: 35620kb
input:
2000 1 2 4 3 1579 710 1523 770 247 251 127 558 1061 473 1314 1750 545 111 1330 1901 1767 1730 464 999 1954 1825 893 637 240 1731 1233 808 787 1552 762 1661 1243 1047 373 869 1787 1030 1386 1724 1142 1403 1640 1763 239 1338 1075 1699 1394 141 675 1063 299 1899 481 963 1290 1545 934 405 883 1599 159 4...
output:
27121439353
result:
ok 1 number(s): "27121439353"
Test #150:
score: 0
Accepted
time: 83ms
memory: 35508kb
input:
2000 1 3 2 4 1866 837 603 408 1217 928 1927 210 1054 717 1119 227 1466 848 1343 708 1807 775 1456 289 1023 1515 1938 192 1840 1081 1743 1762 1351 108 719 1563 730 1896 1794 1860 275 1806 3 807 51 6 1922 739 230 786 1910 1247 685 562 1222 33 586 1337 1348 893 1001 552 597 1146 1858 1007 589 697 1112 ...
output:
27088229151
result:
ok 1 number(s): "27088229151"
Test #151:
score: 0
Accepted
time: 87ms
memory: 35948kb
input:
2000 1 3 4 2 17 250 1749 660 1996 1080 1770 1150 129 814 300 837 1408 1284 1757 1022 1927 219 1141 1953 1552 1506 197 1190 1025 302 671 1836 1783 678 843 1199 630 1543 674 1289 938 69 29 1813 1706 759 1419 206 1085 956 1255 1516 212 1008 713 442 873 1785 12 1534 152 1843 1873 1081 3 1889 811 465 593...
output:
26362128472
result:
ok 1 number(s): "26362128472"
Test #152:
score: 0
Accepted
time: 94ms
memory: 35832kb
input:
2000 1 4 2 3 1512 242 149 1700 764 274 1807 1317 1141 1216 508 1621 701 739 570 1552 1863 338 1660 1333 19 1370 1598 1151 1635 86 1927 1060 626 96 411 1097 1828 1263 1046 972 1877 1856 1392 925 1697 1495 957 333 1302 1672 965 1546 1314 1624 893 961 1627 1472 549 1276 117 1533 1805 948 1038 1956 1531...
output:
26125673133
result:
ok 1 number(s): "26125673133"
Test #153:
score: 0
Accepted
time: 81ms
memory: 35552kb
input:
2000 1 4 3 2 48 1505 1809 1986 768 581 619 1967 1764 667 893 961 1518 771 1340 411 1721 1819 1548 1322 1116 1086 1788 1531 770 1535 1166 629 1277 1658 734 1239 1525 1944 1560 1350 655 1793 55 387 460 1760 105 1201 1572 1588 1881 1083 957 1368 438 1649 1449 237 309 1480 1185 878 41 1586 937 1689 628 ...
output:
27644139539
result:
ok 1 number(s): "27644139539"
Test #154:
score: 0
Accepted
time: 92ms
memory: 35640kb
input:
2000 2 1 3 4 1224 1228 943 1528 947 10 1064 1800 967 825 150 1351 1735 196 789 1870 63 562 645 1824 912 690 232 1772 1875 1918 1000 131 1153 679 621 1022 92 71 1810 1837 1799 1746 793 194 860 1936 950 1931 893 239 814 1833 988 281 1637 604 193 778 1426 1971 1495 706 229 1250 170 1265 260 1202 240 66...
output:
29240349519
result:
ok 1 number(s): "29240349519"
Test #155:
score: 0
Accepted
time: 81ms
memory: 36064kb
input:
2000 2 1 4 3 1277 1326 1642 1496 696 893 1680 1819 1973 35 499 442 1600 701 590 955 1744 1681 1003 1031 1292 284 631 1647 168 1480 1206 1946 594 1633 715 1339 280 1231 909 595 1571 627 796 1217 406 1691 1278 1562 1174 517 1759 638 504 1016 1483 837 1912 667 1397 1865 863 143 1900 1473 1083 1861 1209...
output:
27527316950
result:
ok 1 number(s): "27527316950"
Test #156:
score: 0
Accepted
time: 82ms
memory: 35636kb
input:
2000 2 3 1 4 1254 191 432 367 4 1167 1095 1748 1027 1323 65 918 1841 1935 1624 537 343 1823 553 1356 1522 45 1888 1098 1903 359 652 339 18 1028 1711 1371 850 415 477 1070 1680 522 1379 1009 767 1728 1951 1937 1574 1262 479 1905 458 1538 333 1111 1370 171 1559 1131 1306 1594 1287 461 578 989 492 346 ...
output:
27854690179
result:
ok 1 number(s): "27854690179"
Test #157:
score: 0
Accepted
time: 84ms
memory: 35556kb
input:
2000 2 3 4 1 208 171 368 622 172 1433 1048 739 954 1622 377 525 145 1071 416 1491 1582 1215 634 1937 736 1365 1133 1610 654 1402 146 1256 833 64 965 1692 116 1092 662 357 47 8 1453 1780 1701 921 1570 1973 432 1221 482 1267 1076 800 1269 1632 550 413 769 1918 1266 403 1312 1096 1196 1876 315 1798 407...
output:
26916399633
result:
ok 1 number(s): "26916399633"
Test #158:
score: 0
Accepted
time: 37ms
memory: 35880kb
input:
2000 2 4 1 3 1034 601 873 1741 1809 604 800 1274 560 259 377 650 783 1218 1758 1627 408 703 1288 835 1165 1162 1543 1304 1890 1657 479 1352 1753 1222 1969 695 425 994 1262 1564 1781 725 26 210 244 1114 1637 509 1209 617 1662 1190 1308 333 363 1403 1597 1659 936 1990 711 1920 590 271 181 118 839 1463...
output:
27307132291
result:
ok 1 number(s): "27307132291"
Test #159:
score: 0
Accepted
time: 93ms
memory: 35832kb
input:
2000 2 4 3 1 1967 816 1875 134 1914 1511 1701 910 1922 1617 773 1074 613 31 962 858 1429 405 1661 1370 68 917 284 456 1901 1380 382 289 166 1759 1001 124 209 1702 1162 1249 1667 385 1463 1576 1870 1497 84 1226 683 1923 1406 943 386 1910 1250 676 523 638 976 34 407 432 1494 1270 668 1341 941 1053 122...
output:
26643015843
result:
ok 1 number(s): "26643015843"
Test #160:
score: 0
Accepted
time: 84ms
memory: 35712kb
input:
2000 3 1 2 4 93 1432 189 368 990 346 1061 1025 1947 505 714 1338 1794 55 1974 1946 1084 784 1140 938 171 1601 1195 1908 530 1368 1208 1254 1728 107 28 1078 1481 186 1101 1223 1985 738 673 627 1021 561 1569 124 1559 685 945 1907 1162 871 948 375 1669 1137 305 1538 1092 1858 1509 91 844 1830 523 425 6...
output:
27364223458
result:
ok 1 number(s): "27364223458"
Test #161:
score: 0
Accepted
time: 36ms
memory: 35880kb
input:
2000 3 1 4 2 950 576 1021 1724 837 593 729 778 524 970 29 1965 1148 133 1467 1254 606 1964 535 1830 1771 1613 620 613 1720 1490 765 1556 1500 225 419 1253 632 1165 551 679 701 874 1919 1721 7 435 1073 820 995 1139 212 1935 1697 1731 939 1792 344 30 667 1459 462 976 1759 1643 727 1177 1258 1994 1381 ...
output:
27365385635
result:
ok 1 number(s): "27365385635"
Test #162:
score: 0
Accepted
time: 80ms
memory: 35656kb
input:
2000 3 2 1 4 1924 31 218 1786 1568 969 1566 1968 124 1605 1308 1366 596 251 837 1004 1433 1163 1100 131 1209 572 504 92 120 1782 578 1542 1872 398 1302 1246 846 615 797 1067 156 274 761 1443 182 242 1381 1540 490 1332 238 889 809 323 1440 151 257 141 1822 1962 1132 1431 1593 115 980 1789 335 986 100...
output:
29681722448
result:
ok 1 number(s): "29681722448"
Test #163:
score: 0
Accepted
time: 78ms
memory: 35772kb
input:
2000 3 2 4 1 76 384 445 1077 1094 833 1807 1563 1920 639 693 1957 1006 139 187 509 982 366 570 781 1186 752 1565 880 1569 1706 1214 408 556 808 1321 1419 1499 1221 954 1750 446 272 1981 786 1376 1484 1329 381 172 1795 1068 1930 1510 1544 1301 118 1009 1864 1199 767 1530 1084 1420 1839 1358 1778 650 ...
output:
29813669865
result:
ok 1 number(s): "29813669865"
Test #164:
score: 0
Accepted
time: 79ms
memory: 36580kb
input:
2000 3 4 1 2 1726 457 1641 36 1196 1273 396 928 238 927 1882 1537 1820 528 696 380 218 272 1497 1573 796 1533 336 145 520 1329 833 1943 1048 239 1536 1305 1511 282 388 1793 720 752 1834 6 394 1812 1945 1348 220 295 1863 484 1361 577 559 1968 560 1904 1664 325 914 1655 578 105 1857 489 1550 247 1540 ...
output:
28678789454
result:
ok 1 number(s): "28678789454"
Test #165:
score: 0
Accepted
time: 81ms
memory: 36140kb
input:
2000 3 4 2 1 1787 671 869 12 201 1499 282 761 1409 1472 602 13 1687 159 1284 395 754 1289 1309 697 1173 897 413 1941 428 683 1297 842 1114 1140 1220 131 1437 1772 1180 80 624 737 358 741 478 1332 1898 1515 1433 1422 613 53 1570 763 215 901 1719 1323 1397 1169 1313 188 1192 1589 164 38 1550 976 1819 ...
output:
27492883441
result:
ok 1 number(s): "27492883441"
Test #166:
score: 0
Accepted
time: 99ms
memory: 35624kb
input:
2000 4 1 2 3 1956 1297 1738 1449 1451 1569 499 1814 1373 1438 1868 1637 592 1802 1151 865 1078 1316 1301 414 48 1840 1631 54 1699 812 1671 46 716 1607 416 407 148 1729 1925 1130 1557 938 573 1534 512 1995 1816 674 20 307 1046 1503 247 1857 1244 1198 1553 1410 1955 754 452 228 1473 790 1426 69 1550 1...
output:
29413743863
result:
ok 1 number(s): "29413743863"
Test #167:
score: 0
Accepted
time: 101ms
memory: 35716kb
input:
2000 4 1 3 2 1318 171 1953 179 1559 295 1751 1088 1331 1502 1467 1851 1563 985 1265 675 971 1234 41 739 968 225 1003 1593 1963 1987 894 303 913 445 105 1387 533 70 792 524 487 304 226 141 1860 1336 160 1572 518 159 956 1213 1465 843 1704 1811 1949 431 645 144 559 1886 1425 638 460 1893 589 1918 66 9...
output:
28346732605
result:
ok 1 number(s): "28346732605"
Test #168:
score: 0
Accepted
time: 105ms
memory: 35644kb
input:
2000 4 2 1 3 432 151 66 1407 138 27 1601 1205 724 1390 1784 552 259 1958 1903 1356 521 1275 265 422 1049 915 110 477 340 677 436 1432 1326 1260 1139 1599 1020 371 1116 1735 1752 327 1678 605 1044 547 1652 1998 1300 1159 1013 516 512 61 1959 802 671 1092 1368 288 215 56 833 1923 84 981 1231 1728 5 11...
output:
27565044506
result:
ok 1 number(s): "27565044506"
Test #169:
score: 0
Accepted
time: 92ms
memory: 35600kb
input:
2000 4 2 3 1 277 169 1291 488 549 325 1147 1434 1636 690 1150 282 925 1428 900 623 3 1338 1972 1937 551 113 1934 1610 1997 293 1089 1187 168 1671 1520 1729 851 421 1519 579 649 797 1408 1240 1248 1508 1847 1384 461 395 1564 1391 1149 1236 197 1557 1664 122 1583 237 511 226 824 1226 1352 1984 1337 29...
output:
25498681434
result:
ok 1 number(s): "25498681434"
Test #170:
score: 0
Accepted
time: 77ms
memory: 35552kb
input:
2000 4 3 1 2 1313 1972 721 914 1277 911 1812 1848 900 526 145 1003 1965 1237 1913 374 497 489 1312 970 1009 378 1379 1130 732 1070 876 1884 1457 106 902 1699 1708 841 1776 1990 24 813 1932 1915 338 714 1645 1428 1296 375 1570 69 1692 118 589 428 1659 1224 101 1042 219 221 1742 1201 435 684 153 1864 ...
output:
27316141720
result:
ok 1 number(s): "27316141720"
Test #171:
score: 0
Accepted
time: 76ms
memory: 35616kb
input:
2000 4 3 2 1 200 1740 1033 722 327 231 1801 1953 1279 602 1956 135 1834 61 1151 1227 742 1452 575 1047 791 1758 1637 981 1911 754 1214 1688 274 945 1808 1786 1593 29 623 593 963 1190 456 884 589 1226 1682 263 442 1002 911 1008 1984 128 1620 89 1030 955 1852 900 1268 974 278 326 343 241 1782 1545 148...
output:
27527398018
result:
ok 1 number(s): "27527398018"
Extra Test:
score: 0
Extra Test Passed