QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#480145#404. Solitairegoj_bot180 63ms206380kbC++143.1kb2024-07-16 08:46:022024-07-16 08:46:03

Judging History

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

  • [2024-07-16 08:46:03]
  • 评测
  • 测评结果:80
  • 用时:63ms
  • 内存:206380kb
  • [2024-07-16 08:46:02]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

const int N=2007;

char g[3][N];

ll fac[3*N];
ll inv[3*N];
 
ll pot(ll x,ll p) {ll res=1;for(;p;p>>=1) {if(p&1) res=res*x%mod; x=x*x%mod;} return res;}
ll npok(int n,int k)
{
    if(min(k,n)<0||k>n) return 0;
    return fac[n]*inv[k]%mod*inv[n-k]%mod;
}

void gg()
{
	cout<<0<<endl;
	exit(0);
}

ll DP[N][3*N][2];
ll P[N][3*N][2];
ll S[N][3*N][2];
int t[N];

ll calc(vector<int>a)
{
	int n=sz(a);
	if(n==0) return 1;
	debug(a);
	DP[0][0][0]=1;
	S[0][0][0]=1;
	P[0][0][0]=1;
	ll ans=0;
	FOR(i,1,n)
	{
		t[i]=t[i-1]+a[i-1]+1;
		FOR(j,1,t[i])
		{
			if(a[i-1]==0)
			{
				DP[i][j][0]=(P[i-1][t[i-1]][0]+S[i-1][j][1])%mod;
			}
			if(a[i-1]==1)
			{
				DP[i][j][0]=((ll)(j-1)*(P[i-1][t[i-1]][0]+S[i-1][j-1][1]))%mod;
				DP[i][j][1]=(P[i-1][j-1][0]*(t[i]-j))%mod;
			}
			if(a[i-1]==2)
			{
				if(j>1) DP[i][j][0]=((ll)(j-2)*(ll)(j-1)*(P[i-1][t[i-1]][0]+S[i-1][j-2][1]))%mod;
				DP[i][j][1]=(P[i-1][j-1][0]*(ll)(t[i]-j)*(ll)(t[i]-j-1))%mod;
				if(j>1) DP[i][j][1]=(DP[i][j][1]+P[i-1][j-2][0]*2*(ll)(j-1)*(ll)(t[i]-j))%mod;
				
			}
			if(i==n) ans=(ans+DP[i][j][0]+DP[i][j][1])%mod;
		}
		FOR(l,0,1)
		{
			FOR(j,1,t[i]) P[i][j][l]=(P[i][j-1][l]+DP[i][j][l])%mod;
			ROF(j,t[i],0) S[i][j][l]=(S[i][j+1][l]+DP[i][j][l])%mod;
		}
	}
	FOR(i,0,n)
	{
		memset(DP[i],0,sizeof DP[i]);
		memset(P[i],0,sizeof P[i]);
		memset(S[i],0,sizeof S[i]);
	}
	debug(ans);
	return ans;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    fac[0]=1;
    for(ll i=1;i<=3*n;i++) fac[i]=fac[i-1]*i%mod;
    inv[3*n]=pot(fac[3*n],mod-2);
    for(ll i=3*n-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
    FOR(j,0,2) 
    {
		FOR(i,1,n) cin>>g[j][i];
		if(j==1) continue;
		FOR(i,1,n) if(g[j][i]!='o'&&(g[j][i-1]!='o'||g[j][i+1]!='o')) gg();
	}
	ll ans=1;
	int free=0,tot=0,act=0,W=0;
	vector<int>V;
    FOR(i,1,n)
    {
		int C=(g[0][i]=='x')+(g[2][i]=='x');
		if(g[1][i]=='o')
		{
			free+=C;
			ans=ans*calc(V)%mod;
			W+=act;
			ans=ans*npok(W,act)%mod;
			act=0;
			V.clear();
		}
		else 
		{
			act+=C+1;
			V.pb(C);
		}
	}
	ans=ans*calc(V)%mod;
	W+=act;
	ans=ans*npok(W,act)%mod;
    ans=ans*npok(W+free,free)%mod*fac[free]%mod;
    debug(W,free);
    debug(npok(tot,free));
    cout<<ans<<endl;
    
    return 0;
//asdfdsafdsafdsafds
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 8168kb

input:

21
ooooxoooooxoooooxoooo
oooxooooooooxxxxxooxo
ooxooooooooooooooooxo

output:

319334400

result:

ok single line: '319334400'

Test #2:

score: 0
Accepted
time: 1ms
memory: 8192kb

input:

27
oxoooxooooooooooooooooooooo
ooooooxxxxoooooxoxooooxoooo
oooxooxooxoooxoooxoooooxooo

output:

188603933

result:

ok single line: '188603933'

Test #3:

score: 0
Accepted
time: 1ms
memory: 8128kb

input:

20
oooooooooxooooxoooxo
oxoxoooooooxooooooxo
ooooooooxooooooooooo

output:

40320

result:

ok single line: '40320'

Test #4:

score: 0
Accepted
time: 1ms
memory: 8096kb

input:

13
ooxoxoxooxooo
xoxxxoxxxooxo
ooooxoxoxoxoo

output:

22599513

result:

ok single line: '22599513'

Test #5:

score: 0
Accepted
time: 1ms
memory: 8196kb

input:

13
oxoxooxooxooo
xooxxxxoxoxxx
ooxooooxoxooo

output:

17662907

result:

ok single line: '17662907'

Test #6:

score: 0
Accepted
time: 1ms
memory: 10264kb

input:

11
oxoxoxoxoxo
xxxxoxoxoxo
oxoxoxooxoo

output:

891195994

result:

ok single line: '891195994'

Test #7:

score: 0
Accepted
time: 1ms
memory: 10328kb

input:

14
ooxoooxoxoooxo
xoxxooooxxxoxx
oooxoxooooxoxo

output:

549439514

result:

ok single line: '549439514'

Test #8:

score: 0
Accepted
time: 1ms
memory: 8316kb

input:

14
ooxoooooxooxoo
xxxxxxoxxoxoox
oxoooooxoxoooo

output:

278974156

result:

ok single line: '278974156'

Test #9:

score: 0
Accepted
time: 1ms
memory: 8516kb

input:

11
ooxooxoxoxo
xxxxxoooxox
oxoxoxoxoxo

output:

591208466

result:

ok single line: '591208466'

Test #10:

score: 0
Accepted
time: 1ms
memory: 8340kb

input:

11
ooxoxoxooxo
xxoooxxxxxx
ooxoxoxoxoo

output:

966753075

result:

ok single line: '966753075'

Test #11:

score: 0
Accepted
time: 1ms
memory: 10372kb

input:

15
oooxooooxooxooo
oxooxxoooxxxxxx
ooooxoxoooxoxoo

output:

727472313

result:

ok single line: '727472313'

Test #12:

score: 0
Accepted
time: 1ms
memory: 8512kb

input:

10
oxoxooxooo
xxxxxoxxxx
oxoxoxoxoo

output:

377955629

result:

ok single line: '377955629'

Subtask #2:

score: 12
Accepted

Test #13:

score: 12
Accepted
time: 6ms
memory: 11144kb

input:

880
ooxooooooxoxoooxoxoooooxooxooooxoxooooooooooooooxooooooxoxooooxooooxoxooooooxoxooooooooooxoxooooxooxooxoooooooooooxoxoooooxoooooxoxoxooxoooxooxooooxooooxoxoxoooxoooooxoooxooxoxoooooooxooooxooooooxooooxoxooxoooooxoxooooxooxooooooooooooooxoooooooooooxooooooooooooooxooooxoxoxooooooxooooooooxooooxoo...

output:

934647418

result:

ok single line: '934647418'

Test #14:

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

input:

1862
ooxooxooxooooooooooooxooxoxooxooooooooooxooooooxoooxoooooxooooxooxooxoxoxooxooxoxoxoooooxoooooooooooxooooxooxoooxooooooooooxoxoxooxooxoooooooxooooxoooooooxoxoxoooooxooooooooxoooooooooxoooooxooooooooxooooooxooooooxoxooooxoxoooooxooxooxooxooxooxoooxoooxooxooxooooooxoooooxooooxoxoooxoooxoxooxooooo...

output:

600243618

result:

ok single line: '600243618'

Test #15:

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

input:

822
ooooxoxoooooxoooxooxooxooxoooooxoxoooxoooooxooooxooooxooxooooooooooxoxoxoooooooxoooxoxooxoxooxoxoooxooooxooxoxooooxoxooooxooxooxooxooxoxoxooooooxoooxooooxooooxoooooooxoooooooxoooooooxoooooxooooxooooxoooooxoxoxooxoooxoooooxoooooxooooooxooooxoooxoooxooooxooooooooxoxoxoooooooxooxoooxoooooooooooooox...

output:

890103394

result:

ok single line: '890103394'

Test #16:

score: 0
Accepted
time: 13ms
memory: 11388kb

input:

2000
oooxooooooxoxooooxoooxooooooooooxoooxoooooooxoxoooxooxooooooooooooxoxoooxoxoooooooooxooxooxoxoxoxoooxooooooooooxoxooxooxooooxooxooooxooxoxoooooxoxoxoooooooxooooooxoxooooxoooooooooooxooooxooooooooooxoxooooooooooooxoooxoooooooooxoooooxoooooooooooxoooooooxoooxoooooooooooooooooooooooooxoxoooxoxoooo...

output:

171555266

result:

ok single line: '171555266'

Test #17:

score: 0
Accepted
time: 11ms
memory: 12992kb

input:

2000
oooooxoooxoooxoxoooooooxooooxoxooxooxooooxooooxoxoxooooooxoxoooooxooooooooxooxooooooooooxooxoxoxoxooooxoxooxoooxooooooxooooooooooxooooooooooxooooxooooxoxoooooooooxoooooooxooxoxooooxoxoxooooxoxoxooooxoxoooooooxoxooooooxooxoxooxoxoxoxoxoxoxoooooxoooxoxoooxoooxoxooxooooooooooooooxoxoxoooooooooooox...

output:

475821131

result:

ok single line: '475821131'

Test #18:

score: 0
Accepted
time: 10ms
memory: 10976kb

input:

2000
oxoxooooooxooxoooooxoxoxooxoooxooooooooooooooooxoxoxooxoooxoxoxoooooxoxoxooooxooooooxoooooooooooooxoooxooooooooxooooxoooxoxoxooooooxooxoxoooooxooooxoxoooooooooxoxoxoxoooxoooooooooxooxooxoooooxoooooxoxoxooxoxooooxoooxoooooxooooxooooooooooxooooxoxoooxoxoxoooooooooooxoooooxooooxoxoooooxoxoooooooxo...

output:

946817461

result:

ok single line: '946817461'

Test #19:

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

input:

2000
ooooooxoxoooooxoooxooooooxoxoooooooooooxooooxooooxooooxoxoxoooxoxoxoooxoxooooooooooooxoooxoooooooxoxoooxooxooooxoooxooooooooxoxoooxoxoxoooooxooxoxooooooxoooooooxooxoxooxooooxoooooxooxoxooxoxoxooxooooooooxoooxoxooxooxoxoxooxooooooooooxoooooooooooxoxoxooxoooooxooxooooxoooooooooooxoxooxoooooooxooo...

output:

188870138

result:

ok single line: '188870138'

Test #20:

score: 0
Accepted
time: 10ms
memory: 14164kb

input:

2000
oxooxoooxooooxoooooxoooxoxooxooooooooxoooxoooxoooooooxoxooxoxooooxooxoooooooxoooooxooxooooooooxoxooooooxoxoooooxooooooxooooxoooxoooooxooooooooooooxoooxooxoooxoooooxooxoxoooooooooxoxoooooxoxooooooxoooxooooxoxoooxoooooooxoxoxoooxoooxooxooooooooooooooooxooooxoooxoooooooooxooooxooxooxooooooooooooxo...

output:

208049282

result:

ok single line: '208049282'

Test #21:

score: 0
Accepted
time: 14ms
memory: 13296kb

input:

2000
ooxooooooooxooooxooooxooooooooooooooxooooooxooxooxoooooooooxoooxooooooooooooooooxoxooxoxooooooooooooooooxooooooooxoooxoxooxoooxoxooooooooxooooxooooooxoooooooxoxooooxoooooooooooxooxoxoxoooooxooooooooooxoooooooooooooooooooxoxooooooooooxooxooxoxooxoooooxooxoooxooooooooooooxooooooooxooxoooooxoooxoo...

output:

27109038

result:

ok single line: '27109038'

Test #22:

score: 0
Accepted
time: 6ms
memory: 10564kb

input:

2000
oooxoxoooxooooooooxooxoxooxooooxoxoooooxooooooxooooooooxoooxoooxoxoooxoooxooxooooxoxooooxoxoxoooxooxoooxoxooxooooxoxoooooxoxooooxooxooxoxooooooooxoooxoxoxoxoxooooxoooooooooxoooxooxoxoooooxoxooooxooooxoxooxoooooxooooxooooooooooxoooxooooooxooxooooooooooxoooxoooooooxoooxoooxoooooxoooooooxooooooxoo...

output:

121509401

result:

ok single line: '121509401'

Test #23:

score: 0
Accepted
time: 2ms
memory: 10176kb

input:

2000
oxooooxooxoxooxoooxooxoooooooooxooooooxooxoooxooooxoooxooxoooooxoooxooxoxoxoxoooooxoooxoooxooooooxoooxoooooxooxoooooooooxooooooxoooooxoooooooooxoooooooxooxoxooooxoxoooxoxoxooxooooxooooooxooooooxoxooooxoxooooxoooooxooxoooxooooooxoxoxoxoooxooxoxoooooxoooxooxooxoooxooxooooooxooooxoooxooooxoxoxoooo...

output:

560090782

result:

ok single line: '560090782'

Test #24:

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

input:

2000
ooxoxooooooooooooxooxoxooooooooxooxooooooxoooooooooooooxoooooxoooooxoxoxooooooxooooooooxooooxoxoooooooooxoxoxoooxoooxooxooxoooooooxooxoxoxooxoooooxoxoxoooooooxoooooxooooooooooooooooooxooooxoxooooooxooooooxooxoooooooooxooooooooooxoooxooooooxooxoxooxoooooooooxooooooxoooooooooooooooooooxoooooooooo...

output:

523684295

result:

ok single line: '523684295'

Test #25:

score: 0
Accepted
time: 40ms
memory: 98144kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

629384479

result:

ok single line: '629384479'

Test #26:

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

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

623758907

result:

ok single line: '623758907'

Test #27:

score: 0
Accepted
time: 43ms
memory: 192636kb

input:

2000
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

887139494

result:

ok single line: '887139494'

Test #28:

score: 0
Accepted
time: 31ms
memory: 115292kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

301974922

result:

ok single line: '301974922'

Test #29:

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

input:

2000
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

749172607

result:

ok single line: '749172607'

Test #30:

score: 0
Accepted
time: 47ms
memory: 137528kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

887139494

result:

ok single line: '887139494'

Test #31:

score: 0
Accepted
time: 53ms
memory: 173328kb

input:

2000
ooooooooooooooooooooooooooooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

444076715

result:

ok single line: '444076715'

Test #32:

score: 0
Accepted
time: 43ms
memory: 187308kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooxoxoooooooooooooooooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

924759665

result:

ok single line: '924759665'

Test #33:

score: 0
Accepted
time: 40ms
memory: 166804kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

962531255

result:

ok single line: '962531255'

Test #34:

score: 0
Accepted
time: 44ms
memory: 206380kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

435638357

result:

ok single line: '435638357'

Test #35:

score: 0
Accepted
time: 63ms
memory: 149868kb

input:

2000
ooooooooooooxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

915695315

result:

ok single line: '915695315'

Test #36:

score: 0
Accepted
time: 50ms
memory: 167248kb

input:

2000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

962531255

result:

ok single line: '962531255'

Test #37:

score: 0
Accepted
time: 50ms
memory: 166160kb

input:

2000
oxooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

962531255

result:

ok single line: '962531255'

Subtask #3:

score: 20
Accepted

Test #38:

score: 20
Accepted
time: 2ms
memory: 10340kb

input:

27
oxooooxooooooxoooxoooooxoxo
xxooxooooxxxoxoooxooxxxxxoo
ooxoxoxoxoooxoxooooxoxooxoo

output:

106903779

result:

ok single line: '106903779'

Test #39:

score: 0
Accepted
time: 1ms
memory: 8396kb

input:

30
oxooxoooxoxooxooxoxoooxooxoxoo
oxoxxxxxxoxxxooooooooxoooxoxoo
oooooxoxoooxooxooooooxooxoxoxo

output:

66036158

result:

ok single line: '66036158'

Test #40:

score: 0
Accepted
time: 1ms
memory: 9892kb

input:

24
oxoxooxoxoxoxooooooxooxo
oxooxxoxoxxxxxooooooxxox
ooooxoooxooxoxoxooooxooo

output:

149383387

result:

ok single line: '149383387'

Test #41:

score: 0
Accepted
time: 1ms
memory: 10072kb

input:

30
ooxoooxoxooxooxoxooooxooooxoxo
ooxooxoxooxoxoxoxooxxxoooxxoxx
oooooxoxoooxoxoxoxoxoooxoooooo

output:

910561176

result:

ok single line: '910561176'

Test #42:

score: 0
Accepted
time: 1ms
memory: 8012kb

input:

30
oxoxooxoxoooxooxoooxoooxoxoxoo
xoooooooxxooxoooxxxooooxooooxo
oxooooooooxooxoooooxoxoooxoooo

output:

293821592

result:

ok single line: '293821592'

Test #43:

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

input:

30
oooxoxooxooxoxooxooooxoxoxoooo
xoxxxoxoooxoooxxooxxoxxxxxooox
ooooxooxoxoxoooxoxooxoooxooooo

output:

872573139

result:

ok single line: '872573139'

Test #44:

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

input:

30
oxoooooxoxooxoooxooooooxoooooo
xoxxxxooxooxxxxxxooooooooxxoxo
ooxooxoxoooxoooxoooxoxooxoxoxo

output:

730441506

result:

ok single line: '730441506'

Test #45:

score: 0
Accepted
time: 1ms
memory: 8680kb

input:

30
ooxoxooooxooxooxoooxoxoxooxoxo
ooxoxoooooxoxoxooxxxxxoxxooxox
ooooooxoooxoooooooxoxooooxoxoo

output:

660914814

result:

ok single line: '660914814'

Test #46:

score: 0
Accepted
time: 1ms
memory: 8580kb

input:

30
oxooxoxoooxoxooxooooxooooooooo
ooooxxoxxoooxooxxxoxxoxoxxooxo
oxoooooxoooooxooxoxoooxooooxoo

output:

428046422

result:

ok single line: '428046422'

Test #47:

score: 0
Accepted
time: 1ms
memory: 8236kb

input:

30
oxoxoxoxooooxoxoxooooxooooxoxo
oooxxxoxxxxxoooxxooxoooxoxoxoo
ooxoxoxoxooxooxooxoooxooxooooo

output:

221721657

result:

ok single line: '221721657'

Test #48:

score: 0
Accepted
time: 1ms
memory: 8068kb

input:

30
oxooooxooxoxoooooooxoooooxoooo
oxxxxoooxoxoxxoxoooooxooxxoxox
ooxoooxoxoxooooxoooxooooxoxoxo

output:

715014425

result:

ok single line: '715014425'

Test #49:

score: 0
Accepted
time: 1ms
memory: 8792kb

input:

30
oxoxooxooxooooxoxooxoooxoxoooo
oooxxxxxxooxoxxooxxxxoooooxooo
oooooxoxoxooooooxoooxoooxoxooo

output:

386067960

result:

ok single line: '386067960'

Test #50:

score: 0
Accepted
time: 2ms
memory: 16544kb

input:

30
oxoooooxoooxoxoooxoxoooooooxoo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooooooooxooooooxoooooooxoooooo

output:

860409542

result:

ok single line: '860409542'

Test #51:

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

input:

30
oooooooxoxooxoooooooxooooooooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooooooooxoxooxoooooxoxoxoxoxoo

output:

995241980

result:

ok single line: '995241980'

Test #52:

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

input:

30
ooooooooxoxoooxooxoxooooooxooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooxoooxooooooxoooooooooxoooooo

output:

866425323

result:

ok single line: '866425323'

Test #53:

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

input:

30
ooxooooooooooooooxoooooxoooooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oooxooxoooooooxoxooooooooooxoo

output:

524303660

result:

ok single line: '524303660'

Test #54:

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

input:

30
oxoxooxooxoooooooooooxoooooooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooxoooooxoooxoooxoxoooooxoxooo

output:

156449359

result:

ok single line: '156449359'

Test #55:

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

input:

30
oooooooxooxoooooooxoxoxooooxoo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooooooxooooooooooooooooooxoooo

output:

190329217

result:

ok single line: '190329217'

Test #56:

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

input:

30
ooxoooooooxoxoxoooooxoooxooooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oooooxoxoooooooooooooxoxoooooo

output:

91668789

result:

ok single line: '91668789'

Test #57:

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

input:

30
oooxooxooxoooxoooxooooooxoxooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oooooooooooxooooxoxoxooxoxooxo

output:

985082255

result:

ok single line: '985082255'

Test #58:

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

input:

30
oooxooxoooooooxooxoooooxooxooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oooooxooxoooxoooooxooooooxoooo

output:

533193368

result:

ok single line: '533193368'

Test #59:

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

input:

30
ooooooxoooooooooooooxooooxoooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oxoxooooxooooooooooxooxooooxoo

output:

112232361

result:

ok single line: '112232361'

Test #60:

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

input:

30
oooooxoooooooooooxoooooooooxoo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ooxoooooooxooooxoooxoxoooxoooo

output:

102648974

result:

ok single line: '102648974'

Test #61:

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

input:

30
ooxooooxooooxoooxooooxoooooooo
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oooooooooooxooxooxooooxoxooooo

output:

66615652

result:

ok single line: '66615652'

Subtask #4:

score: 38
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Test #62:

score: 38
Accepted
time: 1ms
memory: 10032kb

input:

89
oooxoxoooxoxoooxooxooxooxoxooxoooooooxoxoxoxoxooxooxooxoxoooooooxoooooxooooxooxoxoxooxooo
xooooooxooxooooooooxxooooxoooxooxxoxooxoooxooooxooooooxooxoxoxoooxxoxoooooooooxooxoxoxoxx
oooxooxoooooooxoxooxoxoooxoooxooxoooxoxoxoooxooxoooooxoooxoooooooxoxoxoxoxoxoxoxooooooxoo

output:

936611356

result:

ok single line: '936611356'

Test #63:

score: 0
Accepted
time: 1ms
memory: 8172kb

input:

168
oooxooooxoxoxoooxoxoxoxooxooooxoxooooooooxoxoooxooooooooxoxoxooxooxoooxooooxoooxooxooxooxooxoooxooxoooooooxoxoxoooooxoxoxoxoxoooooooxoxooooxoxooxoxoxooooxoxoxooooxoxooo
xooooooxoxooxoxoxxxoxxoooxxxoooooooxxxooooxoooxoxoxxooooooxxooxooxoooxoxxxoxxoxooxoxoxooooooooooxoxxxoxxxxooooxooooxoxxoxxoooox...

output:

488163216

result:

ok single line: '488163216'

Test #64:

score: 0
Accepted
time: 1ms
memory: 8372kb

input:

55
oxooxoxoxooxoxooxoxooxoxoxooxooxoxooxoxooxoxooxoxoxoooo
oxxxxxxoxooooxxxxoxoxxxoxxoxoooxxooxoxxooxxxxoxoxxoooxx
oxoxoooxoxoxoxooooxoxooxoxoxoxoxoxoooxooxoxooxoooxoooxo

output:

694744320

result:

ok single line: '694744320'

Test #65:

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

input:

300
ooxooxoooooxooooooooxooxoxoxooxoxoxoxoxoxoxoxoxoooxoxoxoxoxooxoxoxoxoooxoxoooxooxoxoxooxoooxooxoooxoxoxooxoxooxooxoxoxoooxooooxoxooooxooxoxoxooxoxoxooxoooxoooooxoooxoxoxooooxoooxooooxoooxooxoooxoooxooxoooooooxoxooxooxoxooxoxoooxooxoxoooxooooxoxooxoxoxooxoooxoxoxoxoxooxooxoxoxooxoxooxooxoxoooxoxo...

output:

641570109

result:

ok single line: '641570109'

Test #66:

score: 0
Accepted
time: 2ms
memory: 10244kb

input:

300
ooxoooxoooxooxoxooooxoxooxoooooxooxooxooxoooxooooxoooxoxoxooooooxoooxoxoxoxoxoooxoxoooooxooooxoooxooxooooxooxoxooxoxooooxooxooooxoxooooxoooooxooooooooooxoooxoxoooxoooxoxoooxooooxooooxooxoxooxooooooooooooooxooxoxoxoxoxoooxoooooxoooooxoxooooxoxoxoooxooxooooxoxoxoxoxoxooxooooxoxoxoxoooooxoooooxoooo...

output:

174624709

result:

ok single line: '174624709'

Test #67:

score: 0
Accepted
time: 2ms
memory: 8220kb

input:

300
ooxoxooxoooxooooxoooooxoxoxoxooxoooooxoooxooxoxooooooxoxoxooxooooxooooxoxoxoooxoxooxooxooxooxooooooooxooxooooxooxooxooooooxooooxooxooxoxoxooooxoxoxooxoxoxoxoxoxoooxoxoooooxoooooooxoooxoooxoxooooooooxooooxoxooxooxoxoxooxooxoooooooooxooxoxooxooooooxoxooxoxooxoxoooxoooxoxoxooxooxoooxoxoooooooooooox...

output:

955060227

result:

ok single line: '955060227'

Test #68:

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

input:

300
oxooxoxoooxoxoxoxoooxoxoxoxoxoxoxooooxoxoxoxoxoxooxooxoxoxoxooxoxoxoxooooxoxooxooxooxoxoxooooxooxoxoxooooooooxoxooxooxoxoxooxoxooxoxoxoxoxoxoxoxoxoooxoxoxoxoxoxoxoxoooxoxoxoooxooxoxoooxoxoxooooxoxoxoxoxoooxoxooooxooxooooxoxoxoooooxooxoooxoooxoxoxooxooxoxooxoxoxoxoxooxoooxooxoxoxoooxoxooooxooxoxo...

output:

249337514

result:

ok single line: '249337514'

Test #69:

score: 0
Accepted
time: 2ms
memory: 10396kb

input:

300
oxooxooooooooxooooxooxooxoooxooooxooooooxoxoooxooooxoooooxoxooooooxoxoooxooxoooooxooxooooooooxoxoooxooxoxoooxoooooooxooxooxoxoxoxooxoxoooxooooxoooxooxooooxooxoxoxoxooxooxoxooxoxoxooooooooooooooooxoxoooxoxoooxoooooooxooxooooxooxoooooooxooooxoooooooxoxooxoxoxoxoxoxooooxoooooooxoxooxoooxoxoxooooooo...

output:

624398343

result:

ok single line: '624398343'

Test #70:

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

input:

300
oxoxoxoxoxoxooxoxoxoxoxoxooxoooooooxoxoxoooxoxoxoxooxoxoxooxoooxoxooxooxooxoxoooxoooxoxoxooxooxoooxoxoxoxoxooxoxooxoxoxoooxoxooxoxoxooxoxoooxoxoxoxoxoooxooxoxoxooooxoxoooxoxooxoxoooxoxooxoxoxoxoxoxoxooxoxooxoooxoxoxoxooxooxoxooxoooooxooxooxoxoxooxoxoxoxoxoooxoooxooooxoxoooooooooxoxoxooxoxoxooxox...

output:

850829805

result:

ok single line: '850829805'

Test #71:

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

input:

300
ooxooooooxoxooooxoxoooxoxoxoxooxooooooxoxooxoxooooooxoooxooxoooxoooooxoxoooooooooxoxoxoooxooooxooxoxoxoxooooxoooxoxooooxoxoooooxoxooxooooooxooxoooxooxooxooxooxooxoxooxoxooxoooxooooxoooxooooxooooxooxooxoooooxoooxoxooooxooooxooooooooxooxoxoooxoooxoxooxoxoxooxoooxoooxoxooxooxooooooxoxoxooooxoxoooox...

output:

272863863

result:

ok single line: '272863863'

Test #72:

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

input:

300
oxoxooxoxoxoooooooxoxoxooxoxoxoxoxooxoxoxooooooxoxoooxoxooxoxoxooooxooxoxoxoxooxoxoooxoxoxooxoooxooooxooooxooooxoooxoxoxoxoxooxoxooxooxoxoxooxoxoooooxooooxooxoxooxoooxoxooooooxoxoxoxooxooxoxooxoxoooxooooxoxoxooxoxoooxoxooxoxoxoxoooooxooxoooxoxoooxoooooxoxoxoxoxoxoooooooooooxoooxoxooxoxoxoxooxooo...

output:

332341907

result:

ok single line: '332341907'

Test #73:

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

input:

300
ooxoxoooxoxoxoxoxoxoxoxoxoxooxoxoxoxooooooxooxoxoxooooxoxoxoxoxooxoxooxoxoxoxoxoxoxooxoxoxooxoxoooxoxoxooxoxoxoxoxooxooxooxooxoxoxoooooxooxoooxoxoooxoxoxoxooxoxooxooxooxooxoxooxoxoxooxoxoxooxoxoxooxoxooxoxooxooxooxoooxoxoxoxooxoxoxoxoxooxoxoxooxooxooxoxoooxoooxoxoxoxoxoxooxooooxoxoxoxoxoxoxoxoxo...

output:

2532907

result:

ok single line: '2532907'

Subtask #5:

score: 0
Memory Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #74:

score: 20
Accepted
time: 9ms
memory: 8940kb

input:

1554
oxoxooxooxoxooooxoxooxooxoxooxoxoxoxoxoxoxoxoxoxoxooxoxoooxoxoxoxooxoxoxooxoxooooxoxoxoxoxoxoxoxoxoxoxooxoxoxoooxooxooxooxoxooxooxoxoxooxooooxoxoooxooxooxooxooxooxooooxoxoxoxooxooxoxoxoxoxoxooxoxoxoxoxoooxoxoxoxoxooxoxooxooxoxoxoxooxoxoxoxoooxoxooxoxoxoxooxoxooxooxooxoxooxoxoxoxooooxoxoxooxoxoo...

output:

555194198

result:

ok single line: '555194198'

Test #75:

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

input:

629
oxoxoxoxooooooxoxooxoxoxoxoxooxoxoxoxoxoxoxoxoxoxoxoxoxooooxoxoxoxoxoxooxoxooxoxoxoxoxooxooxooxooxooxoxoxooxooxooxoxoxoxooxoxoxoxoxoxoxoxooxooooxoxoxooxoxoxooxooooxooxoxoxoxooxoxoooxoxoxooxoxoxoxooxoxoxoooxoxoxoooxoxooxoxoxooxoxoxoxoxoxooxoxoxoxoxooxoxooxooxoxoxoxooxoxoxooxoxoxoxoxoxoxoxoxooxoxo...

output:

743911705

result:

ok single line: '743911705'

Test #76:

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

input:

1140
oxoxoxoxoxoxoooxooooxooxooxoooxooooxoxoxoxooxoxoxoxoxooxooxooooxooxoxoxoxoxoxooxoxooxooxooxoooxooxoooxoxoxoxooooxooxoxoooxoooooooooxooooooxoxooooooxoxooxooxoxooxoxooxoxoxooxooooooxooxoxoxooxoxoxoxooooooxooooxoxoxoxooxooxooxooooxooxoxooxooxoxooxooxoxoxoxoxooxooxoooxoxooxoxoooxoxooxooxooxooxoxoxo...

output:

99466029

result:

ok single line: '99466029'

Test #77:

score: 0
Accepted
time: 12ms
memory: 9028kb

input:

2000
oxoooxoxooxoxoooxooxooxoooxooooxoxoxooxooooxoxoxooxoxoxoxooxoxoxooxoxoxoxoxoxoxoxooxoxoooxoooxooxooxoooxoxoxoxoxooxoooxoxoooxoxoxoxoxoxooxoxoxoxoxooxoxoooxoxoxooxoooooxooxoxoxoxoxoxoxoxooxoooxoxooxooxooxooxoxoxoxoxoooxoxoxoxoxoxoxoxoxoxoxooxoxoxoxoxoxoxooooxooxoxooxoxoxooxooooxooooooxoxooxooxox...

output:

312568575

result:

ok single line: '312568575'

Test #78:

score: 0
Accepted
time: 13ms
memory: 14160kb

input:

2000
oxoxoxoxoxooxoxoxoxooxoxooooxoxoooxoxoxoxoxoxoxoooxoxooxoxoxoxoxooxoxooxooooxooooxoxoooxoxoxoxoxoxoxoxoooxooxoxoxoxooxooxooxoxoxoxoxoxoxoxooxoxoxooxooooxoxoxoxoxooooxoooooooxoxoxoxoxoxooxoxoxoxoxoxoxooxooxoxooxoxooooxooxooxoxoooxooxoxoxoxoxoxooxoxoxoxoooxoxoooxoxooxoxoxoxooxoxoxoxooxoxoxoxoxoxo...

output:

986705578

result:

ok single line: '986705578'

Test #79:

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

input:

2000
oxooooxooxooxoooxoooxoooxoxoxooxooooxooooooxooooxooxoooxoooxooxoooxoxooxoooxoooxoxoooxoooxooxoooooooxoooxoooxoxoooxoxooxooxooxooooooooooxooooooxooooooxooxoxooxoooooooxoxooxoxooxoxooxoxooxoxoxooxooxoooxoooxoxooxoxoxoxooxoxoxoxoxooooxooxoxoooooxoxoxooxooooxooooxooxoxoxooxooxooxooooxoxoxoooxoxooxo...

output:

451800267

result:

ok single line: '451800267'

Test #80:

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

input:

2000
oxoxoooxoxoxooxoxoxoxooxoxoxoxoxooxoooooxoooxoxoxooxoooxooxooxoxooxooxoxoxoxoxoxoxoxoxooxoxoxoxoxooxoxooxoxooxoxoxoxoooxoxoxoxoxoxoxoxoxoooxoxoxoxoxoxoxoxooxoxoooxoxooxoxoxoxoxoxoxoxoooxoxoxooooooxoxoxooxoxoxoxoxooxoooxoxoxoxooxoxoxoxoxoxoxoxoxoxooxoxoxoxoxoxoxooxoxoxoxoxoxoxooxoxoxooooxoxoxoxo...

output:

180969854

result:

ok single line: '180969854'

Test #81:

score: 0
Accepted
time: 7ms
memory: 11420kb

input:

2000
oxooxooxooxooooxoxooxooxoxooxoxoxoxoxooxoxooxooxoxooxoxoxoxoxoooxoooooooxooooxoxoxoxooxoxooxoxoxooxooxoxoxoxoxoxoxoxoxooxoxoxooxoxoxooxoxooxoxoxoxoxoxooxooxooxoxoxoxoxoxoooxoxooooxoooxoxoxooxoxoxooxooooxoxoxoxoxoxoxoxoxoxoooxooooxooxoxoooxooxoooxooxoxoxoooxoxoxoxoxooxoxooxoxooxoooxoxooxoxoxoxox...

output:

843634884

result:

ok single line: '843634884'

Test #82:

score: 0
Accepted
time: 10ms
memory: 16008kb

input:

2000
ooxoxoxooxoxoxooxoooxoxoxoxoxooxoooxoxoxooxoooxoxoxoooooxoxoxoooooooxoxoxooxoxooxoxoxoxoxooxoxoxooxoxooxoooxoxoxooxooxoxoxooxooxoxooxoxoxoxoooooxooxooooxoxoxoxoxoooxoxoxoxoxoxoxooxoxoxoooxoxoxoxoxooxoxoxoxoxoxoxooxoxoxoxoxoooxooxoxoxoxoxoxoxooxoxoxoxoooxoxoxoxoxooxoxoxoxoxooxoxoxoooxoxooxoxooxo...

output:

430782561

result:

ok single line: '430782561'

Test #83:

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

input:

2000
oxoxoooxoooooooooxooxoxoxooooxooooxooxoxooxooxoxoooooxooxoxoxoxooxoooooxoxoxoooxooxoxoxooooxooooxoxoxoxoxoooxooxoooooxoxooxooxooooxoxooxoxoxoxoooxoxooooxoxooxoxooxoooxooooxoxooooxoxoxooooxoxoxoxoxoooxoooxooooxoxooooooxoooooooooxooxoxoxoooooxoooxooooooooooxooxoxoooooxoooooxooxoooooxoxoooooxoxoxo...

output:

868115132

result:

ok single line: '868115132'

Test #84:

score: 0
Accepted
time: 7ms
memory: 8496kb

input:

2000
oooxooooooxooxoooxoxoxoooxooxooooooxoxooxooxooooxoooxoxoxooxooxoooxoxoxoxoooooxoxoxoooxooooxoxoooooooxooooooxoxooooxooxooxoxoooooooxoooxooooooxoooooxoooxoooxoxoxooooxooxoxoxoxoxoxooooxoxooooxooooxoooxoooxooooooooxoxoxoooxoxooxoooooooooooooxoxoxoooooxoxooxooooxoxooxooooooxooxoooooxooooxooooxoxoo...

output:

421629353

result:

ok single line: '421629353'

Test #85:

score: 0
Accepted
time: 11ms
memory: 13236kb

input:

2000
oooxoxooooooxooooxooxooxoxooxoxoxoxoxoxoooxoxoxooxoxooxoxooxoxoooxooxoooooxoxoooxooooxooxooxoxoooxoxooxoxoxooxooxoooxooxooxoooxoooxooxoxoxooxoxoxoxooxoxoxoxoxoxoxoxoooxoxoxoxoxoxooxooooxooxoxoxoxoxoxoooxoxoxooxoxoxoooxoxoxoxoxoxoxoxoxooxoxoooxooxoxooooxooxoxoxoxooxoooxooooooxoxoooxoxooxoxoxoooo...

output:

848554123

result:

ok single line: '848554123'

Test #86:

score: -20
Memory Limit Exceeded

input:

2000
oxoxoxooxooxooxoxoxoxooxoxoxoxoxoxoxooxooxoxooxoxoxoxooxoooxoxooooxoxoxooxoxoxoxoxooxoxoxooxoxooooxoxoxooooxoxoxoxoxoxoxooxooxooxooxoxoxoooxooxoooxooxoxooxooxoxooxoooxoxooxoxoooxooxoxoxooxooxooxooxoxoxoxoooxoxoxoooxoxoxoxoxoxooxooooooxoxooxoxoxooxooxooxoxooxooxoooooxoxoxoxoxoxoxoxooooxooxooxoox...

output:

803079165

result: