QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#344310#992. Number of Colorful MatchingsCrysflyAC ✓55ms13736kbC++175.3kb2024-03-04 00:19:192024-03-04 00:19:19

Judging History

你现在查看的是最新测评结果

  • [2024-03-04 00:19:19]
  • 评测
  • 测评结果:AC
  • 用时:55ms
  • 内存:13736kb
  • [2024-03-04 00:19:19]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 2
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 1005
#define inf 0x3f3f3f3f

#define poly vector<modint>

template<class T>
poly Char(int n,T a){
	static modint f[1005][1005];
	For(i,1,n-1){
		int p=-1;
		For(j,i+1,n)
			if(a[j][i].x){p=j;break;}
		if(p==-1)continue;
		else if(p!=i+1){
			For(j,1,n)swap(a[p][j],a[i+1][j]);
			For(j,1,n)swap(a[j][p],a[j][i+1]);
		}
		For(j,i+2,n){
			modint tmp=a[j][i]/a[i+1][i];
			For(k,1,n)a[j][k]-=tmp*a[i+1][k];
			For(k,1,n)a[k][i+1]+=tmp*a[k][j];
		}
	}
	f[0][0]=1;
	For(i,1,n){
		For(j,0,n)f[i][j]=0;
		For(j,1,i-1){
			modint tmp=a[j][i];
			For(k,j,i-1)tmp*=a[k+1][k];
			For(k,0,i)f[i][k]-=tmp*f[j-1][k];
		}
		For(j,1,n)f[i][j]+=f[i-1][j-1];
		For(j,0,n)f[i][j]-=a[i][i]*f[i-1][j];
	}
	return poly(f[n],f[n]+n+1);
}

template<class T>
modint det(int n,T a){
	modint res=1;
	For(j,1,n){
		For(i,j,n)
			if(a[i][j].x){
				if(i!=j){
					res=-res;
					For(k,i,n)swap(a[i][k],a[j][k]);
				}
				break;
			}
		if(!a[j][j].x)return 0;
		res*=a[j][j];
		modint iv=1/a[j][j];
		For(i,j+1,n){
			modint tmp=a[i][j]*iv;
			For(k,j,n)a[i][k]-=a[j][k]*tmp;
		}
	}
	return res;
}

template<class T>
modint pf(int n,T a){
	modint res=1;
	for(int i=1;i<=n;i+=2){
		if(!a[i][i+1].x){
			int k=i+1;
			while(k<=n && !a[i][k].x)++k;
			if(k>n)return 0;
			swap(a[i][i+1],a[i][k]);
			For(j,k+1,n)swap(a[i+1][j],a[k][j]);
			For(j,i+2,k-1)swap(a[i+1][j],a[j][k]),a[j][k]=-a[j][k],a[i+1][j]=-a[i+1][j];
			a[i+1][k]=-a[i+1][k];
			res=-res;
		}
		res*=a[i][i+1];
		modint I=1/a[i][i+1];
		For(j,i+2,n){
			modint r=a[i][j]*I;
			For(k,j+1,n)a[j][k]-=r*a[i+1][k];
			For(k,i+2,j-1)a[k][j]+=r*a[i+1][k];
		}
	}
	return res;
}

template<class T>
poly detpoly(int n,int d,T a){
	static modint b[1005][1005];
	int out=0;
	modint coe=1;
	For(i,1,n){
		while(!a[d][i][i].x){
			For(j,i+1,n)if(a[d][i][j].x){
				coe=-coe;
				For(e,0,d)For(k,1,n)swap(a[e][k][i],a[e][k][j]);
				break;
			}
			if(a[d][i][i].x)break;
			++out;
			if(out>n*d+1)return poly(n*d+1,0);
			Rep(e,d,1)For(j,1,n)a[e][i][j]=a[e-1][i][j];
			For(j,1,n)a[0][i][j]=0;
			For(j,1,i-1){
				modint z=-a[d][i][j];
				For(e,0,d) For(k,1,n) a[e][i][k]+=a[e][j][k]*z;
			}
		}
		coe*=a[d][i][i];
		modint I=1/a[d][i][i];
		For(e,0,d)For(j,1,n) if(a[e][i][j].x) a[e][i][j]*=I;
		For(j,1,n)if(i!=j && a[d][j][i].x){
			modint t=a[d][j][i];
			For(e,0,d) For(k,1,n) if(a[e][i][k].x) a[e][j][k]-=t*a[e][i][k];
		}
	}
	For(i,1,n*(d-1))b[i][n+i]=1;
	For(e,0,d-1)For(i,1,n)For(j,1,n)
		b[n*(d-1)+i][n*e+j]=-a[e][i][j];
	poly fs=Char(n*d,b);
	poly f(n*d+1,0);
	For(i,0,n*d-out)f[i]=coe*fs[i+out];
	return f;
}

int n;
modint mat[2][505][505];

signed main()
{
	n=read();
//	For(d,0,1)For(i,1,n)For(j,1,n)mat[d][i][j]=read();
	For(d,0,1)For(i,1,n){
		string s;cin>>s;
		For(j,1,n)mat[!d][i][j]=(s[j-1]&1);//cout<<mat[d][i][j].x<<" \n"[j==n];
	}
	poly res=detpoly(n,1,mat);
	For(i,0,n)cout<<res[i].x<<" ";
	return 0;
}
/*
2
11
10
00
11

2
1 1
1 0

0 0
1 1

(1) (1)
(1+x) (x)

x
-1-x
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 13500kb

input:

2
11
10
00
11

output:

0 0 1 

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 13452kb

input:

10
0100110000
0000010111
0111000111
1000101100
1101000001
1111110000
1001001110
0000000011
0001000010
0100100110
1100010101
0001000001
0001001010
0011100111
0010101111
1001011011
1001100111
0111101001
0010100010
0001111011

output:

0 0 0 1 1 1 1 1 0 0 1 

result:

ok 11 tokens

Test #3:

score: 0
Accepted
time: 3ms
memory: 13500kb

input:

18
001100000000010111
011100011110001011
001101000001111111
000010010011100000
000011000100001001
001001101100010101
000100000100010010
100011100111001010
111110010110111001
100111011110100100
101000100001111011
110000100101011111
101011001000000111
110001011110010101
110010011111001110
001001011100...

output:

0 0 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 

result:

ok 19 tokens

Test #4:

score: 0
Accepted
time: 4ms
memory: 13660kb

input:

18
110000000001011101
110001111000101100
110100000111111100
001001001110000000
001100010000100100
100110110001010100
010000010001001010
001110011100101011
111001011011100110
011101111010010010
100010000111101111
000010010101111110
101100100000011111
000101111001010111
001001111100111000
100101110010...

output:

0 0 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 0 

result:

ok 19 tokens

Test #5:

score: 0
Accepted
time: 48ms
memory: 13500kb

input:

300
00000000010111011100011110001011001101000001111111000010010011100000000011000100001001001001101100010101000100000100010010100011100111001010111110010110111001100111011110100100101000100001111011110000100101011111101011001000000111110001011110010101110010011111001110001001011100100010010000000000...

output:

0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1 ...

result:

ok 301 tokens

Test #6:

score: 0
Accepted
time: 46ms
memory: 13736kb

input:

300
00000001011101110001111000101100110100000111111100001001001110000000001100010000100100100110110001010100010000010001001010001110011100101011111001011011100110011101111010010010100010000111101111000010010101111110101100100000011111000101111001010111001001111100111000100101110010001001000000000001...

output:

0 0 0 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 ...

result:

ok 301 tokens

Test #7:

score: 0
Accepted
time: 48ms
memory: 13720kb

input:

300
00000101110111000111100010110011010000011111110000100100111000000000110001000010010010011011000101010001000001000100101000111001110010101111100101101110011001110111101001001010001000011110111100001001010111111010110010000001111100010111100101011100100111110011100010010111001000100100000000000111...

output:

0 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 1 1 ...

result:

ok 301 tokens

Test #8:

score: 0
Accepted
time: 15ms
memory: 13500kb

input:

200
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 201 tokens

Test #9:

score: 0
Accepted
time: 20ms
memory: 13460kb

input:

230
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000...

output:

0 0 1 0 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 231 tokens

Test #10:

score: 0
Accepted
time: 25ms
memory: 13680kb

input:

270
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000...

output:

0 0 0 1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 271 tokens

Test #11:

score: 0
Accepted
time: 37ms
memory: 13720kb

input:

300
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 301 tokens

Test #12:

score: 0
Accepted
time: 0ms
memory: 13424kb

input:

50
11000111100010110011010000011111110000100100111000
00000011000100001001001001101100010101000100000100
01001010001110011100101011111001011011100110011101
11101001001010001000011110111100001001010111111010
11001000000111110001011110010101110010011111001110
001001011100100010010000000000011101110101...

output:

0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 

result:

ok 51 tokens

Test #13:

score: 0
Accepted
time: 5ms
memory: 13432kb

input:

80
00011110001011001101000001111111000010010011100000000011000100001001001001101100
01010100010000010001001010001110011100101011111001011011100110011101111010010010
10001000011110111100001001010111111010110010000001111100010111100101011100100111
110011100010010111001000100100000000000111011101011011...

output:

0 1 0 0 1 0 1 0 1 0 0 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 

result:

ok 81 tokens

Test #14:

score: 0
Accepted
time: 8ms
memory: 13488kb

input:

120
011110001011001101000001111111000010010011100000000011000100001001001001101100010101000100000100010010100011100111001010
111110010110111001100111011110100100101000100001111011110000100101011111101011001000000111110001011110010101110010011111
001110001001011100100010010000000000011101110101101110...

output:

0 1 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 0 

result:

ok 121 tokens

Test #15:

score: 0
Accepted
time: 16ms
memory: 13460kb

input:

180
111000101100110100000111111100001001001110000000001100010000100100100110110001010100010000010001001010001110011100101011111001011011100110011101111010010010100010000111101111000010
0101011111101011001000000111110001011110010101110010011111001110001001011100100010010000000000011101110101101110100...

output:

0 1 0 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 ...

result:

ok 181 tokens

Test #16:

score: 0
Accepted
time: 19ms
memory: 13500kb

input:

220
1000101100110100000111111100001001001110000000001100010000100100100110110001010100010000010001001010001110011100101011111001011011100110011101111010010010100010000111101111000010010101111110101100100000011111000101111001
010111001001111100111000100101110010001001000000000001110111010110111010011...

output:

1 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 1 0 ...

result:

ok 221 tokens

Test #17:

score: 0
Accepted
time: 33ms
memory: 13484kb

input:

250
0010110011010000011111110000100100111000000000110001000010010010011011000101010001000001000100101000111001110010101111100101101110011001110111101001001010001000011110111100001001010111111010110010000001111100010111100101011100100111110011100010010111
001000100100000000000111011101011011101001111...

output:

0 1 1 1 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 1 0 1 1 1 1 1 0 1 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0 ...

result:

ok 251 tokens

Test #18:

score: 0
Accepted
time: 36ms
memory: 13464kb

input:

270
101100110100000111111100001001001110000000001100010000100100100110110001010100010000010001001010001110011100101011111001011011100110011101111010010010100010000111101111000010010101111110101100100000011111000101111001010111001001111100111000100101110010001001000000000001
1101110101101110100111111...

output:

0 1 0 0 1 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 1 0 0 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 1 0 0 ...

result:

ok 271 tokens

Test #19:

score: 0
Accepted
time: 51ms
memory: 13660kb

input:

300
11001101000001111111000010010011100000000011000100001001001001101100010101000100000100010010100011100111001010111110010110111001100111011110100100101000100001111011110000100101011111101011001000000111110001011110010101110010011111001110001001011100100010010000000000011101110101101110100111111110...

output:

0 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 ...

result:

ok 301 tokens

Test #20:

score: 0
Accepted
time: 46ms
memory: 13664kb

input:

300
00110100000111111100001001001110000000001100010000100100100110110001010100010000010001001010001110011100101011111001011011100110011101111010010010100010000111101111000010010101111110101100100000011111000101111001010111001001111100111000100101110010001001000000000001110111010110111010011111111010...

output:

1 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 ...

result:

ok 301 tokens

Test #21:

score: 0
Accepted
time: 55ms
memory: 13736kb

input:

300
11010000011111110000100100111000000000110001000010010010011011000101010001000001000100101000111001110010101111100101101110011001110111101001001010001000011110111100001001010111111010110010000001111100010111100101011100100111110011100010010111001000100100000000000111011101011011101001111111101001...

output:

0 1 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 ...

result:

ok 301 tokens