QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#798876 | #7260. Ropes | Invincible | AC ✓ | 4ms | 7108kb | C++23 | 1.9kb | 2024-12-04 18:02:21 | 2024-12-04 18:02:22 |
Judging History
answer
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <ctime>
#include <random>
#include <cassert>
#include <numeric>
#include <cmath>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#define pii pair<int, int>
#define fi first
#define se second
#define MP make_pair
#define ep emplace
#define eb emplace_back
#define int long long
#define rep(i, j, k) for (int i = (j); i <= (k); i++)
#define per(i, j, k) for (int i = (j); i >= (k); i--)
typedef double db;
typedef long double ldb;
typedef long long ll;
//typedef __int128 lll;
typedef unsigned long long ull;
typedef unsigned int ui;
using namespace std;
using namespace __gnu_pbds;
bool Mbe;
//char buf[1<<20],*p1,*p2;
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,1<<20,stdin), p1 == p2) ? 0 : *p1++)
int read() {
int s = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') f ^= (c == '-'), c = getchar();
while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar();
return f ? s : -s;
}
template<typename T>void chkmax(T&x,const T&y){x=max(x,y);}
template<typename T>void chkmin(T&x,const T&y){x=min(x,y);}
const int N=100005,mod=1e9+7,inv3=(mod+1)/3,inv2=(mod+1)/2;
int fpow(int x,int k=mod-2){
int res=1;
for(;k;k>>=1){
if(k&1)res=res*x%mod;
x=x*x%mod;
}
return res;
}
int n,c[5],ans,fac[N<<1],ifac[N<<1];
int C(int x,int y){return (x<y||x<0||y<0)?0:fac[x]*ifac[y]%mod*ifac[x-y]%mod;}
bool Med;
signed main() {
fprintf(stderr,"%.3lfMb\n",(&Mbe-&Med)/1024./1024.);
fac[0]=1;
rep(i,1,200000)fac[i]=fac[i-1]*i%mod;
ifac[200000]=fpow(fac[200000]);
per(i,200000,1)ifac[i-1]=ifac[i]*i%mod;
n=read();
rep(i,1,n)c[read()]++;
if((n-1)*2!=c[1]+2*c[2]+3*c[3])return printf("0\n"),0;
ans=1;
rep(i,1,n-2)ans=ans*i%mod;
rep(i,1,c[3])ans=ans*inv2%mod;
printf("%lld\n",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 6996kb
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: 3ms
memory: 7044kb
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: 3ms
memory: 6984kb
input:
5 3 3 3 3 3
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 6976kb
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: 3ms
memory: 6992kb
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: 0ms
memory: 6972kb
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: 0ms
memory: 7048kb
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: 6912kb
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: 6972kb
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: 7044kb
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: 7048kb
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: 6936kb
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: 7000kb
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: 0ms
memory: 7060kb
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: 6940kb
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: 7100kb
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: 7104kb
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: 0ms
memory: 7052kb
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: 4ms
memory: 7040kb
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: 7036kb
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: 7100kb
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: 4ms
memory: 7100kb
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: 7104kb
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: 3ms
memory: 6996kb
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: 3ms
memory: 6996kb
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: 3ms
memory: 6996kb
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: 3ms
memory: 6940kb
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: 3ms
memory: 6980kb
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: 0ms
memory: 7048kb
input:
2 1 2
output:
0
result:
ok 1 number(s): "0"
Test #30:
score: 0
Accepted
time: 3ms
memory: 6996kb
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: 6992kb
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: 3ms
memory: 7056kb
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: 3ms
memory: 7040kb
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: 7044kb
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: 7108kb
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"