QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#275310 | #7260. Ropes | PetroTarnavskyi# | AC ✓ | 5ms | 3628kb | C++20 | 984b | 2023-12-04 16:34:15 | 2023-12-04 16:34:17 |
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 mod = 1'000'000'007;
const int inv2 = (mod + 1) / 2;
int mult(int a, int b)
{
return (LL)a * b % mod;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int ans = 1;
FOR(i, 1, n - 1)
ans = mult(ans, i);
int c1 = 0, c2 = 0, c3 = 0;
FOR(i, 0, n)
{
int a;
cin >> a;
if (a == 1)
c1++;
else if (a == 2)
c2++;
else if (a == 3)
{
c3++;
ans = mult(ans, inv2);
}
}
if (c1 + 2 * c2 + 3 * c3 != 2 * (n - 1))
{
cout << "0\n";
return 0;
}
cout << ans << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3440kb
input:
9 1 3 2 1 3 1 2 1 2
output:
1260
result:
ok 1 number(s): "1260"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
9 1 2 1 1 3 2 1 3 2
output:
1260
result:
ok 1 number(s): "1260"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
5 3 3 3 3 3
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 5ms
memory: 3444kb
input:
100000 3 2 1 3 3 1 3 2 3 3 3 2 1 1 3 2 1 3 1 2 3 2 2 2 3 1 2 3 2 3 3 3 2 2 2 1 3 3 3 3 2 2 3 2 1 1 2 1 3 1 3 1 3 3 1 3 2 3 3 2 1 1 2 2 3 3 3 2 2 1 2 2 3 2 3 3 2 1 3 2 2 3 2 1 2 1 3 2 2 3 1 3 2 3 2 1 2 3 3 2 3 1 2 2 1 3 1 2 1 2 3 3 1 1 3 2 3 1 3 3 3 3 3 2 3 3 2 3 1 2 2 2 1 3 3 2 2 2 1 3 1 1 1 1 2 3 2...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
100000 1 1 1 1 1 1 1 2 2 3 1 1 3 1 2 1 2 1 2 1 1 1 1 1 1 1 2 2 2 2 1 1 3 1 1 1 3 3 3 1 1 1 2 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 2 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 2 1 3 1 2 1 2 2 1 3 3 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 2 1 3 1 3 2 2 3 2 1 1 1 3 1 2 1 1 1 1 1 2 3 3 3 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 4ms
memory: 3580kb
input:
100000 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 3 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 3 1 1 1 1 1 2 1 1 2...
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
100000 2 3 1 2 3 2 2 2 2 2 2 2 1 3 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 1 3 2 2 3 2 1 2 2 2 2 3 2 2 1 2 2 2 2 2 2 2 3 1 2 1 3 1 2 2 2 1 2 3 1 2 2 3 2 3 2 2 2 2 2 3 3 2 2 1 3 2 2 2 2 2 3 2 2 2 1 1 3 2 3 2 2 1 3 1 2 3 2 3 2 2 2 2 2 2 2 2 2 1 2 1 3 2 2 2 3 2 2 2 2 3 1 3 3 2 2 2 1 2 3 2 2 2 3 3 1 2 2...
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 4ms
memory: 3456kb
input:
100000 2 2 3 3 3 1 1 2 1 2 3 1 3 1 1 2 3 1 3 1 3 1 2 2 1 2 3 1 3 2 2 1 3 3 3 1 2 3 3 3 2 3 3 2 2 3 1 3 3 3 1 2 3 3 1 1 3 3 2 2 1 2 2 3 1 3 2 3 1 3 1 3 1 3 1 1 3 3 3 3 2 3 3 2 1 1 1 2 1 3 1 3 1 2 2 2 3 3 3 2 3 1 3 2 3 3 3 3 2 2 1 1 2 2 3 2 2 1 2 3 1 3 3 1 1 3 1 3 3 2 1 3 3 2 2 3 3 2 2 1 1 1 2 3 3 1 3...
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 4ms
memory: 3452kb
input:
100000 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 2 2 1 1 1 2 2 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 1 2 1 3 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 3 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 4ms
memory: 3504kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 3 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3352kb
input:
100000 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 3 3 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 2 2 1 2 1 1 1 1 1 1 1 1 1 3 1 1 2 3 1 1 1 1 1 1 1 3 2 1 1 1 1 3 1 2 3 1 3 1 1 1 1 1 1 1 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 4ms
memory: 3584kb
input:
100000 3 1 1 1 1 1 1 1 1 1 1 3 1 3 3 1 3 1 3 1 1 3 3 3 1 3 1 3 3 1 3 3 3 1 3 3 1 1 1 1 1 3 1 1 1 1 1 1 3 3 2 3 3 3 1 3 1 3 1 3 3 1 3 3 1 1 1 3 1 2 3 1 3 1 1 1 3 1 3 1 1 1 3 1 1 1 1 1 1 3 1 1 1 1 3 1 3 1 3 1 1 3 1 3 3 1 3 1 1 1 3 3 1 1 2 3 3 1 3 3 2 3 3 1 3 3 1 1 1 1 1 1 3 3 1 1 1 1 1 1 1 1 3 1 3 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 4ms
memory: 3496kb
input:
100000 1 3 1 1 1 1 3 1 1 2 1 1 1 3 2 1 3 1 3 3 2 2 3 2 2 2 3 1 3 3 3 1 1 1 3 2 2 2 1 1 2 3 1 1 1 1 1 1 3 2 2 1 3 2 1 1 1 1 1 1 1 3 1 2 1 2 3 1 1 1 3 3 2 1 1 2 2 2 2 1 1 1 1 1 1 3 3 1 1 1 1 1 1 2 1 2 3 2 2 1 1 3 1 1 1 1 2 2 2 1 1 1 1 3 2 1 1 1 3 3 1 1 1 2 1 3 1 2 3 1 1 2 1 2 1 1 1 2 1 1 1 1 2 1 1 3 2...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 4ms
memory: 3344kb
input:
100000 2 1 1 1 1 3 3 1 1 1 1 1 3 3 1 2 3 1 2 1 1 3 1 3 2 3 2 3 1 1 2 2 1 1 1 1 2 2 2 2 3 3 3 1 3 1 1 1 1 2 3 1 3 1 1 1 3 2 3 1 1 2 3 2 2 1 1 1 1 2 2 1 3 3 1 3 1 2 3 2 3 1 1 3 3 3 2 3 3 1 2 1 1 3 1 3 2 3 1 1 2 1 1 3 3 1 1 3 1 3 1 1 3 3 3 2 1 3 1 1 3 3 2 2 3 3 3 1 1 2 3 1 1 1 2 3 2 3 3 1 3 2 3 3 3 3 1...
output:
919886418
result:
ok 1 number(s): "919886418"
Test #15:
score: 0
Accepted
time: 4ms
memory: 3452kb
input:
100000 2 2 2 2 1 2 3 2 2 2 2 3 3 1 2 2 2 2 2 2 3 2 2 2 3 2 2 1 2 2 2 3 2 2 2 2 2 2 2 3 3 1 2 2 3 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 3 2 3 2 2 2 1 2 2 1 2 1 3 2 2 1 1 2 1 1 1 2 2 2 3 2 2 2 2 2 2 3 2 2 2 2 2 2 1 3 1 2 1 2 1 2 2 3 3 2 3 2 2 3 2 2 3 2 3 2 2 3 2 3 2 3 2 2 2 2 1 2 1 2 2 3 2 1...
output:
148292810
result:
ok 1 number(s): "148292810"
Test #16:
score: 0
Accepted
time: 4ms
memory: 3624kb
input:
100000 2 1 3 3 2 2 1 2 2 2 2 2 2 2 2 1 1 2 2 1 2 1 3 3 1 2 2 1 3 2 3 2 1 2 1 2 2 1 1 2 1 3 2 3 1 2 3 2 1 1 1 3 3 2 1 1 3 3 3 2 1 3 2 3 3 1 2 1 3 2 3 2 2 2 1 1 2 2 1 2 2 2 2 2 1 3 3 1 2 2 2 3 2 3 3 2 2 3 2 2 1 2 3 2 3 2 3 2 1 2 3 1 2 2 2 1 2 1 3 3 2 2 2 2 3 2 3 1 2 2 2 2 2 2 3 2 1 3 3 3 3 2 2 2 2 3 2...
output:
450813336
result:
ok 1 number(s): "450813336"
Test #17:
score: 0
Accepted
time: 4ms
memory: 3348kb
input:
100000 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
437199404
result:
ok 1 number(s): "437199404"
Test #18:
score: 0
Accepted
time: 4ms
memory: 3500kb
input:
100000 2 2 2 2 2 1 2 3 2 2 1 2 2 2 2 2 1 1 2 2 3 2 3 2 2 2 2 1 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 3 2 2 2 2 2 3 2 3 2 3 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2...
output:
834463090
result:
ok 1 number(s): "834463090"
Test #19:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
100000 2 1 2 1 3 1 1 3 2 3 3 1 2 2 1 2 2 1 2 2 2 3 2 1 3 2 3 1 2 1 2 2 1 2 2 2 3 3 2 2 3 3 2 1 2 2 2 3 2 3 2 3 1 2 3 3 2 1 3 2 2 2 3 2 2 2 1 2 1 2 3 1 2 2 2 1 2 2 3 2 2 2 2 1 2 2 3 2 2 2 1 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 3 2 1 2 2 1 2 2 3 2 1 2 3 2 3 2 2 1 2 2 2 1 2 2 2 2 2 2 2 1 3 1 3 2 2 3 2 1 3 2 2...
output:
464088820
result:
ok 1 number(s): "464088820"
Test #20:
score: 0
Accepted
time: 4ms
memory: 3392kb
input:
100000 3 1 3 3 3 3 2 3 2 3 2 1 3 2 1 2 2 1 1 2 2 2 3 2 2 2 3 3 1 2 2 1 2 2 1 3 1 2 3 1 1 1 2 2 3 2 3 3 3 3 2 2 2 3 2 2 2 3 3 3 2 2 2 2 2 3 3 2 2 2 2 2 3 1 2 1 2 1 3 2 2 2 2 2 2 2 3 2 3 2 3 1 1 3 3 2 3 1 1 3 3 1 3 2 1 3 2 3 3 3 2 2 1 2 1 2 2 2 1 1 2 2 1 2 3 3 2 2 2 2 2 3 1 2 2 2 2 2 1 2 2 3 2 2 2 2 1...
output:
658273751
result:
ok 1 number(s): "658273751"
Test #21:
score: 0
Accepted
time: 4ms
memory: 3344kb
input:
100000 1 2 2 1 2 2 1 2 2 1 1 2 2 2 2 2 2 2 2 2 3 2 3 1 2 2 2 2 3 2 2 2 2 2 3 2 2 3 2 2 2 3 2 2 3 3 2 2 2 2 2 2 2 1 3 2 2 1 3 2 1 2 2 2 2 2 2 2 3 2 2 1 2 2 2 2 2 2 2 1 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 3 2 2 1 2 2 3 3 2 3 3 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 3 3 2 2 3 2 2 2 1 3 2 2 2 2 2 2 2 2...
output:
749020002
result:
ok 1 number(s): "749020002"
Test #22:
score: 0
Accepted
time: 2ms
memory: 3500kb
input:
100000 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 3 1 2 3 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 3 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 1 1 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 3 2 2 2 2 3 2 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 1...
output:
126071466
result:
ok 1 number(s): "126071466"
Test #23:
score: 0
Accepted
time: 4ms
memory: 3628kb
input:
100000 3 1 1 3 1 3 2 1 3 1 3 1 1 3 3 3 1 3 1 1 1 3 2 1 3 1 1 3 1 3 3 1 1 3 2 1 3 3 1 1 3 3 1 1 1 1 1 1 2 1 2 1 3 2 1 1 1 1 1 1 1 3 3 3 1 1 3 1 2 2 3 1 3 1 3 1 2 3 3 2 3 2 1 3 3 3 3 2 1 3 3 3 3 1 1 3 3 3 3 3 3 2 3 1 2 2 1 1 3 3 1 3 3 2 1 3 2 1 3 1 1 3 1 3 3 3 1 2 3 2 1 1 1 1 1 1 3 3 3 1 3 2 3 3 3 3 2...
output:
815045464
result:
ok 1 number(s): "815045464"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
1331 2 2 3 2 1 2 3 2 2 2 2 3 1 2 2 2 2 3 2 2 3 2 1 3 2 2 3 2 3 3 2 2 3 2 2 1 2 1 1 2 2 1 2 2 3 2 1 2 2 3 1 3 2 1 2 3 1 1 2 2 2 3 2 1 2 1 1 2 2 3 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2 1 1 2 2 3 2 2 1 2 1 2 2 2 2 2 2 2 1 1 1 2 2 2 3 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 3 1 1 2 1 1 3 2 1 2 1 3 2 2 2 2 2 3 2...
output:
818233920
result:
ok 1 number(s): "818233920"
Test #25:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
385 1 1 2 2 2 1 2 3 3 1 1 2 2 3 2 1 3 2 2 2 3 2 3 2 1 3 3 1 2 2 3 3 3 1 2 3 2 3 1 2 2 3 2 3 3 1 1 3 2 1 1 3 3 1 2 3 1 1 2 1 1 1 2 3 1 3 2 2 2 2 1 3 1 2 2 1 1 1 3 2 3 3 1 1 3 2 2 3 2 1 1 3 1 3 3 1 3 3 2 3 3 3 1 2 2 3 3 2 3 2 3 2 1 1 3 2 2 2 3 3 1 2 1 3 1 3 3 2 2 3 3 3 1 1 3 3 1 3 2 3 2 1 3 1 2 1 1 3 ...
output:
467384285
result:
ok 1 number(s): "467384285"
Test #26:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
2065 3 1 1 3 3 3 2 1 2 2 1 3 3 1 2 1 2 1 2 3 1 1 3 2 3 1 3 3 3 3 3 3 3 1 1 1 1 2 3 3 2 3 3 3 1 3 3 1 1 3 3 2 1 3 3 3 2 2 3 3 1 1 3 3 2 3 1 3 3 3 2 3 1 3 2 1 3 1 3 1 3 1 3 1 3 3 1 2 1 1 3 3 1 3 1 3 3 3 1 3 3 1 1 3 3 3 3 2 3 2 3 3 3 3 1 3 3 1 3 3 3 1 3 2 2 3 3 3 3 1 3 1 1 2 1 1 3 3 3 1 3 1 1 2 3 1 1 3...
output:
188426891
result:
ok 1 number(s): "188426891"
Test #27:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
43 1 3 1 1 1 1 2 1 2 3 3 3 1 3 2 1 1 3 2 2 3 2 2 3 3 1 1 3 1 1 1 3 3 3 1 1 3 1 1 2 2 3 3
output:
657497820
result:
ok 1 number(s): "657497820"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3348kb
input:
561 2 3 3 1 1 2 1 1 2 1 1 2 2 2 2 2 3 2 3 1 3 1 1 1 2 2 2 2 1 2 1 1 1 2 2 3 2 2 1 3 2 1 3 2 1 1 1 1 1 2 2 2 2 1 2 1 1 3 1 2 1 2 1 1 1 2 3 2 3 3 1 2 2 2 2 2 3 1 1 1 3 3 2 1 2 3 3 2 3 3 2 2 2 3 2 1 2 1 2 1 2 1 2 2 3 2 2 2 3 2 1 2 2 3 3 1 3 2 2 2 3 2 3 3 3 2 3 2 1 1 3 1 2 3 2 1 1 3 2 1 1 1 3 3 1 1 1 2 ...
output:
479845932
result:
ok 1 number(s): "479845932"
Test #29:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
2 1 2
output:
0
result:
ok 1 number(s): "0"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
7 1 1 3 3 1 1 2
output:
30
result:
ok 1 number(s): "30"
Test #31:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
130 2 1 2 2 3 2 2 1 2 1 2 3 3 2 2 1 1 3 3 1 2 1 2 3 2 1 2 2 3 1 2 1 2 3 2 1 2 2 2 2 2 1 1 3 3 1 2 1 2 2 2 2 1 2 3 1 1 3 2 3 1 3 3 3 1 1 2 1 2 1 3 3 2 2 2 1 1 2 3 1 2 1 2 1 2 2 2 2 2 3 3 3 2 2 3 3 2 3 1 3 2 3 2 1 1 1 1 2 3 2 2 1 2 1 2 3 1 2 2 2 3 2 3 2 3 3 2 2 2 3
output:
297870439
result:
ok 1 number(s): "297870439"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3356kb
input:
8417 2 1 1 3 1 3 3 3 3 1 3 1 1 3 1 3 3 3 3 1 3 3 3 1 3 1 3 3 1 1 1 3 1 3 3 1 1 3 1 1 3 3 3 1 1 3 3 1 1 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 3 3 3 1 3 1 3 1 3 3 3 3 1 1 1 1 2 3 3 1 3 1 3 3 1 3 3 1 3 1 3 1 3 1 1 1 1 3 3 1 3 1 1 1 1 1 1 3 3 3 1 3 3 1 3 1 3 1 1 1 3 1 1 3 1 1 3 2 3 1 3 1 1 3 2 3...
output:
380707477
result:
ok 1 number(s): "380707477"
Test #33:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
6433 2 3 2 3 2 3 1 3 3 2 2 1 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 3 1 2 2 2 3 2 2 3 2 2 3 3 3 1 2 2 3 1 2 3 2 2 2 2 1 2 2 2 3 2 2 2 2 2 2 2 2 1 3 2 2 1 1 1 2 2 2 2 1 2 2 2 1 2 2 3 2 3 1 2 3 3 3 3 2 2 2 2 2 1 3 3 1 2 1 2 1 2 2 2 2 1 3 1 2 1 2 2 2 3 2 3 1 3 2 2 3 2 2 3 2 2 2 2 2 2 3 3...
output:
30227426
result:
ok 1 number(s): "30227426"
Test #34:
score: 0
Accepted
time: 4ms
memory: 3612kb
input:
100000 3 1 3 1 1 1 3 1 3 3 3 3 1 1 1 1 3 1 3 1 3 3 1 3 3 1 1 1 1 3 1 1 1 1 3 3 1 1 3 1 1 1 3 1 1 1 3 3 3 1 3 1 1 1 3 3 3 3 1 3 1 3 1 1 1 1 3 1 1 1 3 3 1 1 3 1 1 1 1 1 3 1 3 1 3 3 3 1 1 1 3 3 1 3 1 3 1 3 3 3 3 3 3 3 3 1 3 3 3 1 1 3 1 1 3 1 1 3 1 3 1 1 3 3 1 3 3 1 3 1 3 1 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1...
output:
320555407
result:
ok 1 number(s): "320555407"
Test #35:
score: 0
Accepted
time: 4ms
memory: 3452kb
input:
100000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
248941163
result:
ok 1 number(s): "248941163"