QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#823927 | #9876. Self Checkout | WrongAnswer_90 | AC ✓ | 38ms | 33084kb | C++23 | 5.6kb | 2024-12-21 10:48:43 | 2024-12-21 10:48:47 |
Judging History
answer
#include<bits/stdc++.h>
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define ll long long
#define lll __int128
#define fi first
#define se second
#define e emplace
#define eb emplace_back
#define db double
#define ef emplace_front
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vp vector<pii>
#define vt vector<tup>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define FastI
#define FastO
//#define Print
//#define int ll
bool ST,dbg;
static const ll MOD=998244353,Phi=998244352,inv2=499122177,Root=3,iRoot=332748118;
static const ll inf=1073741823,INF=4611686018427387903;
static const ld eps=1e-9,pi=3.1415926535;
char in[1<<20],*p1=in,*p2=in;
char out[1<<20],*p3=out;
using namespace std;
struct tup
{
int x,y,z;
tup(int X=0,int Y=0,int Z=0)
{x=X,y=Y,z=Z;}
bool operator <(const tup nd)const
{return x<nd.x;}
};
#ifdef FastI
#ifdef Print
#define getchar() ((p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1),(dbg?cerr<<(char)(*p1),0:0),*p1++)
#else
#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1++)
#endif
#endif
#ifdef FastO
#define putchar(x) (p3-out==1<<20?fwrite(out,1,1<<20,stdout),p3=out,0:0,*p3++=x)
#define puts(x) write(x,'\n')
#endif
namespace FastIO
{
template<typename T> inline void write(T x,char ch=' ')
{
if(is_same<char,T>::value)putchar(x);
else
{
if(x<0)x=-x,putchar('-');
static char st[25];
int top=0;
do st[top++]=x%10+'0',x/=10;while(x);
while(top)putchar(st[--top]);
}
ch!='~'?putchar(ch):0;
}
inline void write(const char*x,char ch=' ')
{
for(int i=0;x[i]!='\0';++i)putchar(x[i]);
ch!='~'?putchar(ch):0;
}
inline void read(char&s){do s=getchar();while(s=='\n'||s==' ');}
inline void read(char s[])
{
int len=0;char st;
do st=getchar();while(st=='\n'||st==' ');
s[++len]=st,st=getchar();
while(st!='\n'&&st!=' '&&st!='\r')s[++len]=st,st=getchar();
s[++len]='\0';
}
template<typename T> inline void read(T &s)
{
char ch=getchar();s=0;
while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
bool tf=(ch=='-'&&(ch=getchar()));
while(ch>='0'&&ch<='9')s=(s<<1)+(s<<3)+ch-'0',ch=getchar();
s=tf?-s:s;
}
inline void edl(){putchar('\n');}
template<typename T1,typename T2> inline void read(pair<T1,T2> &s){read(s.fi),read(s.se);}
template<typename T,typename...Args> inline void write(T x,Args...args){write(x,'~'),write(args...);}
template<typename T,typename...Args> inline void read(T&x,Args&...args){read(x),read(args...);}
#ifdef FastO
struct Writer{~Writer(){fwrite(out,1,p3-out,stdout);}}Writ;
#endif
}
using namespace FastIO;
namespace MTool
{
inline int Cadd(int a,int b){return (ll)a+b>=MOD?(ll)a+b-MOD:a+b;}
inline int Cdel(int a,int b){return a-b<0?a-b+MOD:a-b;}
inline int Cmul(int a,int b){return 1ll*a*b%MOD;}
inline int sqr(int a){return 1ll*a*a%MOD;}
inline void Madd(int&a,int b){a=((ll)a+b>=MOD?(ll)a+b-MOD:a+b);}
inline void Mdel(int&a,int b){a=(a-b<0?a-b+MOD:a-b);}
inline void Mmul(int&a,int b){a=1ll*a*b%MOD;}
inline int Cmod(int x){return (x%MOD+MOD)%MOD;}
inline void Mmod(int&x){x=(x%MOD+MOD)%MOD;}
template<typename T> inline bool Mmax(T&a,T b){return a<b?a=b,1:0;}
template<typename T> inline bool Mmin(T&a,T b){return a>b?a=b,1:0;}
template<typename...Args> inline void Madd(int&a,int b,Args...args){Madd(a,b),Madd(a,args...);}
template<typename...Args> inline void Mmul(int&a,int b,Args...args){Mmul(a,b),Mmul(a,args...);}
template<typename...Args> inline void Mdel(int&a,int b,Args...args){Mdel(a,b),Mdel(a,args...);}
template<typename...Args> inline int Cadd(int a,int b,Args...args){return Cadd(Cadd(a,b),args...);}
template<typename...Args> inline int Cmul(int a,int b,Args...args){return Cmul(Cmul(a,b),args...);}
template<typename...Args> inline int Cdel(int a,int b,Args...args){return Cdel(Cdel(a,b),args...);}
template<typename...Args,typename T> inline bool Mmax(T&a,T b,Args...args){return Mmax(a,b)|Mmax(a,args...);}
template<typename...Args,typename T> inline bool Mmin(T&a,T b,Args...args){return Mmin(a,b)|Mmin(a,args...);}
inline int power(int x,int y){int s=1;for(;y;y>>=1,Mmul(x,x))if(y&1)Mmul(s,x);return s;}
}
using namespace MTool;
namespace WrongAnswer_90
{
const int N=3000000;
int fr[N+10],inv[N+10];
inline int C(int n,int m){return m<0||m>n?0:Cmul(fr[n],inv[m],inv[n-m]);}
inline void init(int n=N)
{
fr[0]=inv[0]=1;
for(int i=1;i<=n;++i)fr[i]=Cmul(fr[i-1],i);
inv[n]=power(fr[n],MOD-2);
for(int i=n-1;i>0;--i)inv[i]=Cmul(inv[i+1],i+1);
}
inline int calc(int n)
{return Cdel(C(2*n,n),C(2*n,n-2));}
int n;
int a[1000010];
void mian()
{
init();
read(n);
int ans=1;
for(int i=1;i<=n;++i)read(a[i]);
for(int i=1;i<n;++i)if(a[i]==1)
return puts("0"),void();
int lst=0;
if(a[n]==1)lst=n-1;
else
{
for(int i=n,fl=0;i>=1;fl|=a[i]==3,--i)
if(fl&&a[i]==2){lst=i;break;}
}
int pre=1;
for(int i=1;i<=lst;++i)
if(a[i]==2)Mmul(ans,calc(i-pre)),pre=i+1;
if(a[lst]==3)Mmul(ans,calc(lst-pre+1));
if(a[n]==1)return write(ans,'\n');
int tmp=n-lst,tmp2=0,sum=0;
for(int i=lst+1;i<=n;++i)tmp2+=a[i]==3;
Madd(sum,Cdel(C(tmp+tmp2,tmp),C(tmp+tmp2,tmp+2)));
Madd(sum,Cmul(tmp-tmp2,calc(tmp2)));
write(Cmul(ans,sum),'\n');
}
inline void Mian()
{
int T=1,C;
// read(T);
for(int _T=1;_T<=T;++_T)
{
// dbg=_T==1;
mian();
}
}
}
bool ED;
signed main()
{
// ios::sync_with_stdio(0);
// freopen("1.in","r",stdin);
// freopen("1.out","w",stdout);
WrongAnswer_90::Mian();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 23ms
memory: 30244kb
input:
2 3 2
output:
5
result:
ok "5"
Test #2:
score: 0
Accepted
time: 21ms
memory: 28192kb
input:
6 3 2 2 3 2 1
output:
4
result:
ok "4"
Test #3:
score: 0
Accepted
time: 27ms
memory: 30104kb
input:
5 3 2 1 3 2
output:
0
result:
ok "0"
Test #4:
score: 0
Accepted
time: 30ms
memory: 32724kb
input:
1000000 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
0
result:
ok "0"
Test #5:
score: 0
Accepted
time: 22ms
memory: 32988kb
input:
743956 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok "0"
Test #6:
score: 0
Accepted
time: 25ms
memory: 32928kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
686017352
result:
ok "686017352"
Test #7:
score: 0
Accepted
time: 35ms
memory: 32508kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
40768340
result:
ok "40768340"
Test #8:
score: 0
Accepted
time: 37ms
memory: 33084kb
input:
1000000 3 2 3 2 3 2 2 2 2 3 2 2 3 3 2 3 3 3 3 2 2 2 3 2 2 3 3 3 3 3 3 2 2 2 2 3 2 3 2 3 2 3 3 3 3 2 2 3 3 2 2 2 2 3 2 3 2 3 2 3 2 2 2 3 2 2 3 2 3 3 2 2 2 3 3 3 3 2 2 3 3 3 3 3 3 3 2 3 2 2 2 3 3 2 2 2 2 2 3 3 3 3 2 3 3 2 3 2 2 3 3 3 2 2 2 3 2 2 3 2 3 3 3 2 3 3 2 2 3 2 3 3 2 2 2 2 3 2 3 3 2 2 3 3 3 2 ...
output:
524330066
result:
ok "524330066"
Test #9:
score: 0
Accepted
time: 34ms
memory: 32328kb
input:
1000000 3 2 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 3 2 2 3 2 2 3 3 2 3 3 2 3 2 2 3 3 3 3 3 2 2 2 2 3 2 2 2 2 3 2 3 3 2 2 2 3 3 3 3 3 2 2 3 3 3 3 3 2 3 2 3 2 3 2 2 3 3 2 3 2 3 3 3 3 2 2 3 2 2 3 3 3 3 3 2 2 2 3 3 3 3 3 3 3 3 2 2 2 3 2 3 2 2 2 3 2 2 3 2 2 2 3 2 3 2 3 3 2 2 2 2 2 3 2 3 2 3 2 3 2 2 2 2 2 2 2 3 ...
output:
759933131
result:
ok "759933131"
Test #10:
score: 0
Accepted
time: 37ms
memory: 33004kb
input:
1000000 3 3 3 2 3 3 2 2 3 3 3 2 2 2 3 3 2 3 3 2 3 2 2 3 3 3 2 2 3 3 3 2 3 2 2 3 3 3 3 3 3 2 2 3 3 3 3 2 2 2 2 3 2 2 3 3 3 3 3 2 3 2 3 3 3 3 2 2 3 3 2 2 2 3 2 2 2 3 3 2 2 2 2 3 2 3 3 2 2 3 2 3 3 3 2 2 3 3 3 3 2 3 2 3 2 3 2 2 2 3 3 2 2 2 2 3 3 3 3 2 2 3 2 3 3 3 3 3 3 3 3 2 2 3 3 3 3 2 2 2 2 3 3 2 2 3 ...
output:
7146987
result:
ok "7146987"
Test #11:
score: 0
Accepted
time: 33ms
memory: 32084kb
input:
1000000 3 3 3 2 2 2 2 3 3 3 3 3 2 3 2 2 3 2 2 2 2 3 3 3 3 3 2 2 2 2 3 2 3 3 2 2 2 3 2 2 3 3 2 2 2 2 2 2 2 2 3 3 2 3 3 3 2 3 2 2 3 2 2 2 3 2 3 3 2 3 2 2 2 2 3 2 3 3 2 2 2 3 2 2 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 3 2 2 3 3 2 3 3 3 2 2 2 2 2 3 2 2 2 3 3 2 2 2 2 3 2 2 3 2 3 3 3 3 2 2 2 3 2 3 2 3 2 3 2 2 3 2 ...
output:
683068701
result:
ok "683068701"
Test #12:
score: 0
Accepted
time: 37ms
memory: 32392kb
input:
1000000 2 2 2 2 3 3 2 3 3 3 3 3 3 2 3 2 2 2 2 2 3 2 2 2 3 2 2 2 3 2 3 2 3 2 2 2 2 2 3 2 3 3 3 2 2 3 3 2 2 2 2 2 3 3 3 3 2 2 3 2 2 2 2 2 3 2 2 3 3 2 2 2 3 3 2 3 3 3 3 2 3 2 3 3 2 3 3 3 2 2 2 2 2 2 2 2 3 3 3 2 3 2 3 2 2 2 3 2 2 3 2 2 3 3 2 2 3 2 3 2 2 2 3 3 2 3 2 3 3 2 2 2 2 3 3 3 2 2 2 3 3 3 2 2 3 3 ...
output:
2294624
result:
ok "2294624"
Test #13:
score: 0
Accepted
time: 33ms
memory: 33000kb
input:
637586 2 2 2 2 2 2 3 2 2 2 3 3 2 2 3 3 2 2 2 3 3 3 2 3 2 2 3 3 3 2 3 3 3 3 3 2 3 2 3 3 3 2 3 2 2 3 3 2 3 2 3 2 2 2 3 3 3 2 3 3 2 3 2 2 3 2 2 2 2 3 3 2 2 3 3 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 2 3 3 2 2 2 3 3 3 2 3 2 3 3 3 2 2 2 3 2 2 3 2 3 3 3 3 2 3 2 3 2 3 2 3 3 2 2 3 2 3 2 2 3 2 2 3 3 2 3...
output:
710149533
result:
ok "710149533"
Test #14:
score: 0
Accepted
time: 30ms
memory: 32100kb
input:
731846 3 3 2 2 2 3 2 2 2 2 3 3 3 2 3 3 2 2 3 3 3 3 2 3 2 3 2 2 2 2 3 3 3 3 2 3 3 2 3 3 3 2 3 3 3 3 3 3 2 2 3 2 3 2 2 2 2 3 3 2 3 3 3 3 2 3 3 3 2 3 2 3 3 3 3 2 3 2 2 2 2 3 3 2 2 2 3 2 3 3 3 3 2 2 3 2 3 3 3 3 3 3 2 3 3 2 3 3 2 2 2 2 3 3 2 3 2 2 2 3 3 2 2 3 3 3 2 2 2 3 3 2 2 2 3 2 2 3 3 2 2 3 2 2 3 3 2...
output:
175239255
result:
ok "175239255"
Test #15:
score: 0
Accepted
time: 29ms
memory: 31512kb
input:
234456 3 2 2 3 2 2 3 3 2 2 3 2 2 3 2 3 2 3 3 2 3 2 2 3 2 2 3 2 2 3 3 2 2 2 2 3 3 2 2 3 3 2 2 2 2 3 2 3 2 3 2 2 2 2 2 3 3 2 2 3 2 3 2 2 2 2 3 2 2 3 2 3 2 3 2 3 2 3 2 2 2 3 3 3 3 2 2 2 2 2 2 3 3 2 3 3 3 3 3 2 2 3 3 3 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 2 3 3 2 2 3 2 2 2 3 2 2 3 2 3 2 2 3 2 3 3 3 3 2 3 3 2 3...
output:
178259636
result:
ok "178259636"
Test #16:
score: 0
Accepted
time: 37ms
memory: 32024kb
input:
614641 3 2 3 2 2 2 2 2 3 2 2 2 2 3 2 2 3 3 3 3 2 2 3 3 2 2 2 2 2 2 3 2 3 2 3 2 3 3 3 3 3 3 3 3 2 2 2 2 3 3 3 3 2 3 2 2 2 3 3 2 2 3 3 2 3 2 2 2 3 2 2 2 3 2 2 2 2 3 3 3 3 2 3 3 3 2 3 2 2 3 2 3 2 3 3 3 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 3 3 2 3 3 2 2 2 2 3 3 2 2 3 2 3 3 3 2 2 2 2 2 3 2 3 3 3 3 3 2 2 3 2 3...
output:
590475478
result:
ok "590475478"
Test #17:
score: 0
Accepted
time: 32ms
memory: 33016kb
input:
550862 3 3 3 2 2 2 2 2 3 2 3 2 3 3 3 3 2 3 2 3 2 3 3 3 2 3 3 2 3 2 3 2 3 3 3 2 3 2 3 3 3 2 2 2 3 2 3 2 2 2 2 3 2 3 3 3 2 2 3 2 3 2 2 2 3 2 3 3 3 3 3 3 2 2 2 3 3 3 2 3 3 3 2 2 3 3 3 3 2 3 3 3 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 2 3 2 3 2 3 3 2 2 3 3 3 3 3 2 2 3 2 2 3 2 2 2 3 2 3 2 3 2 3 2 2 2 2 3 2 3 3 2 3...
output:
496316643
result:
ok "496316643"
Test #18:
score: 0
Accepted
time: 29ms
memory: 33020kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
1000001
result:
ok "1000001"
Test #19:
score: 0
Accepted
time: 27ms
memory: 30748kb
input:
108766 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
108767
result:
ok "108767"
Test #20:
score: 0
Accepted
time: 31ms
memory: 32892kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
403803660
result:
ok "403803660"
Test #21:
score: 0
Accepted
time: 27ms
memory: 32932kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
207755525
result:
ok "207755525"
Test #22:
score: 0
Accepted
time: 30ms
memory: 32292kb
input:
1000000 3 2 2 2 2 2 3 2 3 3 2 3 2 2 2 3 3 3 2 3 3 3 2 3 2 3 2 2 3 3 3 3 3 2 3 3 2 3 3 3 2 3 2 2 2 3 2 2 2 2 2 3 2 3 3 3 3 2 3 2 2 3 3 2 3 3 3 2 2 3 2 3 3 3 3 2 2 3 2 3 2 3 2 3 2 3 2 2 2 2 3 3 2 2 2 2 3 2 2 3 2 2 2 3 2 2 3 2 2 3 3 2 3 3 3 2 2 3 3 2 3 2 3 3 2 2 3 3 2 2 2 2 2 2 3 2 3 2 2 3 3 3 3 2 2 3 ...
output:
0
result:
ok "0"
Test #23:
score: 0
Accepted
time: 31ms
memory: 32420kb
input:
1000000 2 2 3 2 3 3 3 2 2 2 2 3 2 3 3 3 2 2 3 3 2 2 2 3 3 2 3 3 2 3 3 2 2 3 2 2 2 2 2 2 2 3 3 3 2 2 3 2 2 3 2 3 3 3 2 3 2 2 3 3 3 2 3 3 3 3 3 2 2 3 2 2 3 3 3 3 2 2 3 3 3 3 3 3 2 3 3 2 2 2 3 3 3 2 2 3 2 2 2 2 2 3 2 3 2 3 2 3 2 2 3 2 3 2 2 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 2 2 3 2 2 3 2 3 3 2 3 3 2 3 2 2 ...
output:
0
result:
ok "0"
Test #24:
score: 0
Accepted
time: 31ms
memory: 32928kb
input:
1000000 3 2 2 3 3 2 2 2 3 3 3 2 3 3 2 3 3 3 3 2 2 2 3 3 3 2 2 3 3 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 3 2 3 3 3 3 3 3 3 3 2 3 3 3 3 2 3 2 3 2 3 3 2 2 3 2 3 3 2 3 3 3 3 3 2 3 2 3 3 2 2 2 2 2 2 3 2 2 3 2 2 2 2 3 2 3 3 2 3 2 2 3 2 2 3 3 3 2 2 2 2 2 3 3 3 2 2 2 2 3 3 3 2 3 2 3 3 2 2 2 2 3 2 3 2 2 2 3 2 2 3 ...
output:
0
result:
ok "0"
Test #25:
score: 0
Accepted
time: 27ms
memory: 32928kb
input:
1000000 3 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 3 2 2 3 2 3 2 2 3 2 3 3 3 2 2 3 2 3 2 2 2 2 2 2 3 2 3 3 3 3 3 2 2 3 3 2 2 3 2 2 3 2 2 3 2 3 3 2 3 3 2 3 2 3 3 3 2 2 3 3 3 2 3 2 2 2 3 3 2 2 2 2 2 3 2 3 3 2 3 3 2 2 2 3 2 2 3 3 2 3 2 2 2 3 2 3 3 3 2 3 2 2 3 2 3 2 2 3 3 2 3 3 2 2 2 3 2 2 3 2 3 3 2 2 3 2 2 3 2 ...
output:
0
result:
ok "0"
Test #26:
score: 0
Accepted
time: 31ms
memory: 32860kb
input:
1000000 3 3 2 3 2 2 2 2 3 2 2 2 3 2 2 3 3 2 3 2 3 3 2 2 2 3 2 3 3 3 2 2 3 2 3 3 3 2 2 3 3 3 2 3 2 3 2 2 2 3 2 3 3 3 2 2 3 3 3 2 3 2 2 2 3 3 3 2 3 2 2 3 3 2 2 2 3 2 2 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 2 3 2 3 3 3 3 3 3 3 2 3 3 2 3 2 2 3 3 3 2 3 2 3 2 3 3 3 3 3 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 3 2 3 2 2 ...
output:
0
result:
ok "0"
Test #27:
score: 0
Accepted
time: 29ms
memory: 32900kb
input:
511376 3 2 2 2 2 2 3 3 2 3 2 2 2 3 2 3 3 3 2 2 3 3 3 2 2 2 2 3 3 2 2 3 2 3 3 3 3 3 2 3 2 3 2 3 2 3 2 2 3 3 3 3 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 3 2 2 3 2 3 3 2 2 2 3 2 3 2 3 2 2 2 2 2 2 3 3 2 2 3 3 3 2 2 2 3 3 3 2 2 2 2 3 2 2 2 3 3 2 2 2 3 3 2 2 3 2 2 3 3 3 3 3 3 3 3 3 2 3 2 2 3 3 2 2 2 2 2 2 3 3 3...
output:
0
result:
ok "0"
Test #28:
score: 0
Accepted
time: 23ms
memory: 28724kb
input:
104296 3 3 2 3 3 2 3 3 3 3 2 3 3 2 3 2 3 3 2 2 2 2 3 3 3 3 2 3 3 3 3 3 3 2 2 3 2 3 2 2 2 3 3 2 2 3 3 3 2 3 3 2 3 2 3 2 2 2 2 3 3 3 2 2 3 2 3 2 2 3 3 2 2 2 2 3 2 3 3 3 2 3 2 2 2 2 2 2 2 3 3 3 2 3 3 2 2 3 3 3 2 3 2 2 3 2 3 3 2 2 2 2 3 2 2 2 2 2 2 2 2 3 3 3 3 2 2 3 2 2 3 2 3 3 3 3 3 2 2 3 3 2 2 3 2 3 2...
output:
0
result:
ok "0"
Test #29:
score: 0
Accepted
time: 26ms
memory: 28968kb
input:
119245 2 2 2 3 2 2 2 3 2 2 3 2 3 3 3 2 3 2 2 2 3 2 3 2 2 3 2 2 2 2 3 3 2 3 3 3 2 3 3 2 2 3 2 3 3 3 3 2 3 3 2 2 3 3 2 2 3 3 3 3 3 2 2 2 3 2 2 2 3 3 2 3 3 2 3 3 2 2 2 2 3 2 3 2 2 2 2 3 2 2 3 2 2 2 3 3 3 3 3 3 2 3 3 2 3 2 2 3 2 3 3 3 3 3 2 3 2 3 3 3 2 2 2 3 2 2 3 2 3 2 3 2 2 2 2 3 2 3 3 2 2 3 3 3 2 2 3...
output:
0
result:
ok "0"
Test #30:
score: 0
Accepted
time: 25ms
memory: 32860kb
input:
499896 2 3 3 3 2 2 3 3 3 2 2 3 3 3 2 3 2 3 2 3 3 3 2 3 3 3 2 3 3 3 3 3 2 3 2 2 2 3 3 3 2 3 3 3 2 2 3 2 3 2 3 2 2 2 3 3 3 3 2 3 3 3 2 3 3 2 3 3 3 2 2 2 2 2 3 2 2 3 2 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 2 3 3 3 2 3 3 3 2 3 3 2 3 2 3 3 2 3 2 3 2 2 3 3 3 3 2 3 3 2 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 2 3 3 3 3 3 2 2...
output:
0
result:
ok "0"
Test #31:
score: 0
Accepted
time: 34ms
memory: 31956kb
input:
870424 3 3 3 3 3 2 3 3 2 3 2 3 2 2 3 2 3 2 2 3 3 2 3 2 3 3 2 2 3 2 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 2 3 2 2 2 3 2 2 3 2 2 2 3 2 2 2 2 2 3 2 2 2 2 3 3 3 3 3 3 3 2 2 2 2 3 2 2 3 3 3 2 3 2 3 3 2 2 2 2 3 3 2 3 2 3 2 3 3 3 2 3 3 3 3 2 3 3 2 3 2 2 3 2 2 2 3 3 2 3 3 2 2 2 3 2 3 2 2 2 3 2 2 2 2 3 2 3 2 3...
output:
0
result:
ok "0"
Test #32:
score: 0
Accepted
time: 33ms
memory: 32792kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
686017352
result:
ok "686017352"
Test #33:
score: 0
Accepted
time: 21ms
memory: 28780kb
input:
100432 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...
output:
848135413
result:
ok "848135413"
Test #34:
score: 0
Accepted
time: 35ms
memory: 33048kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
481078003
result:
ok "481078003"
Test #35:
score: 0
Accepted
time: 32ms
memory: 32216kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
429280846
result:
ok "429280846"
Test #36:
score: 0
Accepted
time: 34ms
memory: 33004kb
input:
1000000 2 2 3 2 3 3 2 2 1 3 2 2 3 2 1 3 2 1 2 1 3 1 1 2 1 3 3 1 2 2 1 2 2 1 2 2 2 2 1 3 3 1 2 3 2 1 2 1 3 1 2 2 2 2 2 3 1 2 2 3 2 2 1 3 3 2 3 2 3 2 1 1 2 3 1 1 3 2 3 1 1 2 1 2 1 2 2 3 2 3 1 2 1 3 2 3 1 1 2 3 1 2 3 1 3 2 2 2 3 1 2 2 2 3 2 3 1 3 3 2 2 2 2 3 3 3 2 2 1 3 1 3 1 1 3 2 1 3 2 1 1 3 1 2 1 1 ...
output:
0
result:
ok "0"
Test #37:
score: 0
Accepted
time: 26ms
memory: 32260kb
input:
1000000 2 3 2 1 2 2 1 1 2 3 3 2 2 3 1 3 3 3 2 2 3 1 3 3 2 1 1 1 1 3 2 1 2 2 2 3 1 3 2 2 2 3 2 2 2 2 1 2 2 1 1 1 1 1 1 1 1 3 1 1 3 1 2 2 1 1 2 1 1 3 3 2 3 3 2 2 2 2 3 1 2 1 1 2 1 1 3 3 3 2 2 1 3 3 1 3 2 2 2 2 3 3 3 1 2 3 2 2 1 1 2 2 2 3 2 3 1 3 2 3 2 1 2 1 1 3 3 1 2 1 2 1 2 2 2 3 2 3 3 2 1 2 1 2 1 2 ...
output:
0
result:
ok "0"
Test #38:
score: 0
Accepted
time: 23ms
memory: 32212kb
input:
1000000 3 1 3 1 1 1 1 2 2 2 1 3 3 2 2 3 2 3 3 2 3 3 3 2 2 1 3 3 3 3 3 2 3 2 3 1 1 1 2 2 1 1 3 2 3 1 3 3 1 2 3 3 2 2 1 3 1 1 1 2 3 2 1 1 3 2 2 3 3 3 2 3 1 3 3 2 3 2 1 1 2 2 3 1 1 2 3 2 2 3 1 3 2 3 2 2 2 1 3 3 1 2 3 1 3 3 1 2 2 2 1 3 2 3 3 2 2 3 1 3 3 3 3 3 3 1 1 2 1 1 3 2 1 1 1 1 1 3 2 3 1 3 3 3 3 2 ...
output:
0
result:
ok "0"
Test #39:
score: 0
Accepted
time: 31ms
memory: 32580kb
input:
1000000 2 2 2 2 3 2 1 2 2 1 1 2 3 1 1 1 2 2 3 3 2 1 3 3 2 1 3 3 1 2 2 2 2 1 1 2 2 1 3 1 3 1 3 3 1 2 3 2 2 3 1 2 3 2 3 3 3 1 3 2 1 2 2 3 2 1 3 3 3 3 1 1 2 2 3 1 3 1 2 1 2 3 3 3 2 3 1 2 2 2 2 2 3 3 2 2 3 2 1 1 2 3 1 1 2 1 2 1 3 2 3 2 2 2 2 1 1 3 1 2 1 3 2 1 2 1 2 3 3 1 2 2 3 1 3 3 3 2 1 1 2 3 1 3 1 2 ...
output:
0
result:
ok "0"
Test #40:
score: 0
Accepted
time: 30ms
memory: 32008kb
input:
1000000 2 1 2 1 3 3 2 2 1 1 1 3 2 3 3 2 2 2 1 3 2 1 3 2 2 2 3 3 1 1 2 2 2 2 3 2 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 2 3 2 1 1 1 1 1 1 3 1 2 1 3 3 3 2 3 1 3 2 3 2 1 1 2 3 3 3 3 2 1 2 3 2 2 1 1 1 3 2 1 1 1 2 1 1 1 2 1 2 2 3 2 1 3 2 3 1 1 2 1 2 3 1 3 1 3 3 1 2 2 3 1 1 2 3 1 1 1 3 2 2 3 3 3 2 2 2 2 2 3 1 2 ...
output:
0
result:
ok "0"
Test #41:
score: 0
Accepted
time: 34ms
memory: 33060kb
input:
897920 2 2 1 1 3 1 1 2 1 2 2 2 2 3 2 1 3 3 3 3 1 1 3 3 3 3 3 1 2 1 2 1 2 3 1 2 2 2 3 2 2 1 2 2 1 2 2 1 2 1 3 1 3 3 1 1 3 2 3 3 3 3 1 3 1 1 2 2 1 1 2 1 3 3 2 3 3 1 3 2 3 1 2 2 2 3 1 2 2 1 3 2 3 3 3 1 2 1 1 1 3 1 2 3 3 1 1 2 1 2 2 2 2 2 1 1 3 3 3 3 2 1 1 3 1 1 2 1 1 1 1 3 3 3 3 3 2 1 1 1 3 1 1 3 2 1 1...
output:
0
result:
ok "0"
Test #42:
score: 0
Accepted
time: 29ms
memory: 32932kb
input:
685690 1 2 3 2 3 3 2 1 3 2 3 3 3 2 1 2 1 3 2 3 2 1 2 3 3 2 2 2 1 1 1 1 2 1 3 1 1 3 1 1 3 3 1 1 2 1 2 3 1 3 2 2 2 1 1 3 2 1 2 2 3 2 3 3 3 2 3 3 2 2 2 3 2 1 3 1 2 1 1 1 3 2 3 1 3 2 1 3 2 1 1 2 3 2 2 1 2 3 2 1 2 3 2 3 3 3 2 1 2 3 2 3 2 1 2 3 1 1 1 2 1 3 3 2 1 3 3 2 2 3 3 1 3 2 2 1 3 1 2 3 2 3 1 1 2 2 2...
output:
0
result:
ok "0"
Test #43:
score: 0
Accepted
time: 25ms
memory: 32404kb
input:
664461 3 3 3 3 1 2 1 1 3 1 3 3 1 2 2 3 3 3 2 3 1 2 1 3 1 1 3 1 1 2 1 1 1 1 3 1 1 3 3 1 3 2 3 3 3 2 2 2 1 3 1 1 2 1 1 3 1 3 2 2 3 3 3 1 2 3 3 3 3 2 2 1 3 1 2 1 3 1 2 3 1 3 1 3 1 1 1 3 3 2 1 3 2 2 1 2 3 1 2 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 3 1 1 2 1 1 1 2 3 3 2 3 2 2 1 1 1 2 1 1 3 1 2 2 2 1 1 3 3 3 1 1 3...
output:
0
result:
ok "0"
Test #44:
score: 0
Accepted
time: 30ms
memory: 32664kb
input:
900750 2 3 2 3 1 1 1 2 1 3 2 2 1 1 1 3 2 2 2 3 1 3 1 1 3 2 3 2 2 3 3 1 2 2 2 2 2 3 1 2 1 1 2 2 1 2 1 2 1 3 2 3 2 3 1 1 3 3 1 2 3 3 1 1 3 3 1 2 2 2 2 3 1 1 3 1 3 2 2 1 2 1 3 1 2 3 1 3 1 1 1 3 2 2 1 3 3 1 3 3 3 1 3 3 3 2 2 3 2 3 3 1 3 2 3 1 2 3 2 3 2 2 1 1 3 3 2 3 2 1 1 2 1 1 1 1 2 1 1 2 3 2 3 2 3 2 3...
output:
0
result:
ok "0"
Test #45:
score: 0
Accepted
time: 27ms
memory: 32328kb
input:
190397 3 1 3 2 3 2 1 1 1 3 2 2 1 1 2 3 1 2 1 1 2 2 1 2 2 3 3 2 2 3 1 2 3 1 1 3 1 3 3 1 1 3 1 2 2 1 1 3 3 2 1 3 1 3 3 3 2 1 2 3 2 3 2 2 1 3 3 3 1 2 2 3 1 3 2 2 3 1 2 2 2 1 2 2 2 3 1 2 1 1 2 3 1 1 3 1 2 1 3 3 1 3 1 1 1 2 1 3 3 3 2 2 2 3 2 3 1 1 3 3 3 2 3 3 2 2 2 3 2 1 2 3 2 3 3 2 3 3 1 2 3 1 2 1 3 2 2...
output:
0
result:
ok "0"
Test #46:
score: 0
Accepted
time: 32ms
memory: 32648kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
831727446
result:
ok "831727446"
Test #47:
score: 0
Accepted
time: 26ms
memory: 31896kb
input:
1000000 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
122657581
result:
ok "122657581"
Test #48:
score: 0
Accepted
time: 26ms
memory: 32288kb
input:
1000000 1 2 2 1 1 1 2 1 3 2 1 3 1 3 2 3 1 1 1 2 2 2 3 2 1 3 1 2 2 3 2 3 1 2 2 1 1 3 3 3 2 3 1 2 1 1 2 1 3 3 3 1 2 3 3 3 1 1 2 1 3 1 2 1 1 1 1 2 2 1 3 3 1 2 1 1 3 3 3 2 3 3 1 2 2 2 1 3 2 3 3 2 2 1 1 2 3 2 1 1 3 2 2 3 1 1 3 1 2 1 1 2 2 2 1 2 2 3 3 2 2 2 2 1 3 1 3 3 2 1 3 1 3 3 2 1 3 2 2 3 2 1 1 2 3 3 ...
output:
0
result:
ok "0"
Test #49:
score: 0
Accepted
time: 27ms
memory: 32704kb
input:
1000000 2 2 3 2 2 2 1 2 1 2 1 2 3 1 3 1 3 2 1 3 3 3 3 1 1 1 2 1 3 3 3 2 2 2 1 1 3 3 1 2 2 1 3 3 1 2 3 2 3 1 3 2 3 2 2 3 2 1 3 3 1 3 3 3 3 1 1 1 3 2 3 2 2 2 1 3 1 2 3 2 3 2 1 1 2 2 3 2 1 3 3 2 2 2 3 2 1 1 1 3 2 2 1 3 3 3 3 3 1 3 2 2 1 1 3 3 2 1 2 2 2 1 2 2 2 3 3 3 3 1 1 1 3 2 1 2 2 1 2 2 3 2 3 1 2 1 ...
output:
0
result:
ok "0"
Test #50:
score: 0
Accepted
time: 27ms
memory: 30312kb
input:
8 2 2 1 1 2 1 2 2
output:
0
result:
ok "0"
Test #51:
score: 0
Accepted
time: 31ms
memory: 30288kb
input:
4 1 2 1 2
output:
0
result:
ok "0"
Test #52:
score: 0
Accepted
time: 32ms
memory: 32456kb
input:
1000000 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
2999999
result:
ok "2999999"
Test #53:
score: 0
Accepted
time: 28ms
memory: 33060kb
input:
1000000 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
2
result:
ok "2"
Test #54:
score: 0
Accepted
time: 37ms
memory: 33020kb
input:
1000000 2 3 3 2 3 2 3 3 2 3 2 2 3 3 3 2 3 2 2 3 3 2 2 3 3 2 3 3 2 2 2 3 2 3 2 3 3 3 2 2 2 3 2 2 2 2 3 2 3 2 3 2 2 2 3 3 3 3 3 2 3 3 3 2 2 2 3 3 3 2 3 2 3 3 3 3 3 3 2 2 2 2 3 3 3 2 3 2 3 3 2 2 3 2 2 3 2 2 3 3 2 2 2 2 2 3 3 2 3 2 3 3 2 3 3 3 2 2 2 2 3 2 2 2 3 3 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 3 2 3 2 3 ...
output:
820447236
result:
ok "820447236"
Test #55:
score: 0
Accepted
time: 33ms
memory: 33072kb
input:
1000000 2 2 3 3 3 3 3 3 3 3 2 2 3 3 2 2 2 3 3 3 2 2 3 2 2 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 2 3 3 2 2 2 3 2 3 2 2 2 3 3 3 2 3 3 3 2 2 2 3 3 2 2 2 2 2 2 3 3 2 3 2 3 2 3 3 2 3 3 3 2 3 2 3 2 2 3 2 2 3 3 2 3 2 2 3 3 2 2 2 2 3 3 3 2 3 2 3 3 3 2 3 3 3 3 3 2 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 2 2 3 2 2 3 3 3 ...
output:
748187707
result:
ok "748187707"
Test #56:
score: 0
Accepted
time: 34ms
memory: 32400kb
input:
1000000 3 2 2 2 2 2 3 2 2 2 3 3 3 3 3 2 2 2 3 3 2 3 2 3 2 3 2 2 3 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 2 2 3 3 2 2 2 2 3 2 2 2 2 2 3 2 2 3 2 2 3 3 3 2 2 3 2 2 2 2 2 2 3 2 3 3 3 3 2 3 2 2 3 2 3 2 3 3 2 2 3 2 3 2 3 2 2 2 3 3 2 3 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 3 2 3 3 2 2 2 2 2 2 2 2 3 3 3 2 2 2 3 3 3 2 2 3 2 ...
output:
232126478
result:
ok "232126478"
Test #57:
score: 0
Accepted
time: 37ms
memory: 32596kb
input:
1000000 2 3 2 2 3 2 3 3 2 2 3 2 2 2 2 3 3 2 2 3 2 3 2 3 2 3 2 3 3 3 3 2 3 3 2 2 3 2 2 2 2 3 3 3 2 3 3 2 2 2 2 2 2 3 3 3 3 2 3 2 3 2 3 2 2 2 2 3 3 2 2 3 3 3 3 2 3 2 3 2 3 2 3 3 3 2 3 3 2 3 2 2 3 3 3 2 2 2 2 3 3 2 2 2 2 2 2 2 3 2 3 3 3 2 2 3 3 3 3 3 2 2 2 2 3 2 2 3 2 3 3 2 2 2 3 3 3 2 3 3 2 3 2 2 2 3 ...
output:
766356020
result:
ok "766356020"
Test #58:
score: 0
Accepted
time: 38ms
memory: 32448kb
input:
1000000 2 3 3 2 2 2 2 2 2 2 3 2 2 3 3 2 2 3 2 3 2 2 3 2 3 2 2 3 2 3 2 2 2 2 2 2 2 2 2 3 3 2 3 3 2 3 3 2 2 3 2 2 3 2 3 3 2 2 2 2 2 3 3 3 3 2 3 3 3 3 2 3 2 2 3 3 3 2 2 2 2 2 3 3 2 2 2 2 2 3 2 3 2 3 2 3 3 2 2 3 2 3 2 2 2 2 3 3 2 3 3 2 2 2 2 2 3 3 3 2 2 2 2 2 2 2 2 3 3 3 2 3 2 3 3 3 2 3 3 2 3 3 3 2 3 2 ...
output:
667015541
result:
ok "667015541"
Test #59:
score: 0
Accepted
time: 30ms
memory: 32636kb
input:
287217 3 3 3 2 2 2 2 3 2 2 2 2 3 2 2 3 3 3 3 3 3 3 2 2 2 2 3 2 2 3 3 2 2 2 3 3 3 2 2 3 2 2 3 2 3 3 2 2 2 3 3 2 2 2 3 2 3 3 2 2 2 2 2 2 3 3 2 2 2 2 3 3 3 3 2 3 3 2 2 2 2 2 3 2 3 2 2 2 2 3 3 2 2 3 3 3 2 3 3 3 2 2 3 3 3 3 2 3 2 2 3 3 2 3 2 2 2 3 3 2 2 2 2 3 2 3 2 3 2 3 3 3 2 2 3 3 3 3 2 2 2 2 3 3 2 3 2...
output:
331407254
result:
ok "331407254"
Test #60:
score: 0
Accepted
time: 24ms
memory: 32388kb
input:
155307 3 2 2 2 3 3 3 2 2 3 3 2 2 3 3 3 3 3 3 2 2 3 3 2 2 3 2 2 3 2 3 2 2 3 2 3 3 3 2 2 3 3 2 3 2 2 3 3 2 2 2 3 2 3 2 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 3 3 2 3 3 2 2 3 3 3 2 3 2 2 2 2 3 2 2 3 3 2 3 3 3 2 3 2 3 2 3 3 3 3 2 2 2 3 2 3 2 2 2 3 3 3 3 3 2 3 3 2 2 3 3 2 3 3 2 3 3 2 2 3 3 3 2 2...
output:
869312595
result:
ok "869312595"
Test #61:
score: 0
Accepted
time: 32ms
memory: 30968kb
input:
167271 2 3 3 3 3 3 3 2 3 3 3 3 2 3 2 2 3 3 2 3 2 2 3 2 3 3 2 3 2 3 3 3 3 3 2 2 3 3 2 3 2 2 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 2 3 2 2 3 2 3 3 3 3 3 2 2 2 2 2 2 3 2 3 3 3 2 2 3 2 3 2 3 3 3 3 3 3 3 2 3 2 3 3 2 2 2 2 2 2 2 3 2 3 2 2 3 2 3 3 2 2 2 3 3 3 2 3 3 2 2 3 3 3 3 3 3 2 2 2 3 2 2 3 2 3 2 2 3 3 2 2 3...
output:
922488383
result:
ok "922488383"
Test #62:
score: 0
Accepted
time: 34ms
memory: 32988kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
513338050
result:
ok "513338050"
Test #63:
score: 0
Accepted
time: 38ms
memory: 32992kb
input:
1000000 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
182405174
result:
ok "182405174"
Test #64:
score: 0
Accepted
time: 30ms
memory: 28204kb
input:
3 1 2 3
output:
0
result:
ok "0"
Test #65:
score: 0
Accepted
time: 26ms
memory: 28176kb
input:
3 1 3 2
output:
0
result:
ok "0"
Test #66:
score: 0
Accepted
time: 29ms
memory: 28264kb
input:
3 2 1 3
output:
0
result:
ok "0"
Test #67:
score: 0
Accepted
time: 26ms
memory: 30272kb
input:
3 2 3 1
output:
2
result:
ok "2"
Test #68:
score: 0
Accepted
time: 30ms
memory: 28200kb
input:
3 3 1 2
output:
0
result:
ok "0"
Test #69:
score: 0
Accepted
time: 26ms
memory: 30164kb
input:
3 3 2 1
output:
2
result:
ok "2"
Extra Test:
score: 0
Extra Test Passed