QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203516#2474. Art Transactionnameless_story#AC ✓1ms4124kbC++207.5kb2023-10-06 17:55:432023-10-06 17:55:44

Judging History

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

  • [2023-10-06 17:55:44]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4124kb
  • [2023-10-06 17:55:43]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
template<class T1,class T2> bool cmin(T1 &x,const T2 &y) { if (y<x) { x=y; return 1; }return 0; }
template<class T1,class T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; }return 0; }
const int dbg=0;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cout<<fixed<<setprecision(15);
	int n,i,j,k,l;
	cin>>n;
	// assert(n==9);
	{
		string ip;
		getline(cin,ip);
	}
	vector<string> a(n);
	for (auto &s:a)
	{
		getline(cin,s);
		s.resize(n,' ');
		// assert(s==" *^!/\\vDG");
		// cerr<<s<<endl;
	}
	auto av=[&](int x,int y) { return x>=0&&y>=0&&x<n&&y<n; };
	ll ans=0;
	{//suns
		int cnt=0;
		const static int dx[8]={1,1,1,0,0,-1,-1,-1};
		const static int dy[8]={-1,0,1,-1,1,-1,0,1};
		vector ed(n,vector<int>(n));
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]=='*') for (l=0; l<8; l++) for (k=1; k<n; k++)
		{
			int x=i+dx[l]*k,y=j+dy[l]*k;
			if (!av(x,y)) break;
			if (a[x][y]==' ') continue;
			ed[x][y]=1;
			break;
		}
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]!='*'&&ed[i][j])
			++cnt;
		ans+=cnt*100;
		if (dbg) cerr<<"suns: "<<cnt<<' '<<ans<<endl;
	}
	{//biggest bird
		int cnt=0;
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		vector ed(n,vector<int>(n));
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (!ed[i][j]&&(a[i][j]=='D'||a[i][j]=='v'))
		{
			vector<pair<int,int>> axis;
			function<void(int,int)> dfs=[&](int x,int y)
				{
					ed[x][y]=1;
					axis.push_back({x,y});
					for (int k=0; k<4; k++) if (int nx=x+dx[k],ny=y+dy[k]; av(nx,ny)&&!ed[nx][ny]&&(a[nx][ny]=='D'||a[nx][ny]=='v')) dfs(nx,ny);
				};
			dfs(i,j);
			for (auto &[x,y]:axis) swap(x,y);
			sort(all(axis));
			map<pair<int,int>,int> dp;
			int mx=0;
			for (auto [x,y]:axis) cmax(mx,dp[{x,y}]=dp[{x-1,y}]+1);
			cnt+=mx;
		}
		ans+=cnt*500;
		if (dbg) cerr<<"biggest bird: "<<cnt<<' '<<ans<<endl;
	}
	{//Flock perimeter
		int cnt=0;
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		vector ed(n,vector<int>(n));
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (!ed[i][j]&&(a[i][j]=='D'||a[i][j]=='v'))
		{
			int cur=0;
			function<void(int,int)> dfs=[&](int x,int y)
				{
					ed[x][y]=1;
					for (int k=0; k<4; k++) if (int nx=x+dx[k],ny=y+dy[k];  av(nx,ny)&&!ed[nx][ny]&&(a[nx][ny]=='D'||a[nx][ny]=='v')) dfs(nx,ny);
					else if (!av(nx,ny)||a[nx][ny]!='D'&&a[nx][ny]!='v')
					{
						++cur;
					}
				};
			dfs(i,j);
			cnt+=cur;
		}
		ans+=cnt*60;
		if (dbg) cerr<<"Flock perimeter: "<<cnt<<' '<<ans<<endl;
	}
	{//House view up
		int cnt=0;
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]==' ')
		{
			for (k=i+1; k<n; k++) if (a[k][j]!=' ')
			{
				cnt+=a[k][j]=='^';
				break;
			}
		}
		ans+=cnt*15;
		if (dbg) cerr<<"House view up: "<<cnt<<' '<<ans<<endl;
	}
	{//3*3 blocks
		set<string> s;
		for (i=0; i+2<n; i++) for (j=0; j+2<n; j++) s.insert(a[i].substr(j,3)+a[i+1].substr(j,3)+a[i+2].substr(j,3));
		int cnt=s.size();
		if (dbg) cerr<<"3*3 blocks: "<<cnt<<' '<<ans<<endl;
		ans+=1*cnt;
	}
	{//Animals 1
		int cnt=0;
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]=='!'||a[i][j]=='D'||a[i][j]=='v')
			for (k=0; k<4; k++)
			{
				int x=i+dx[k],y=j+dy[k];
				// cerr<<i<<' '<<j<<' '<<x<<' '<<y<<endl;
				cnt+=av(x,y)&&a[x][y]==' ';
			}
		ans+=cnt*15;
		if (dbg) cerr<<"Animals 1: "<<cnt<<' '<<ans<<endl;
	}
	{//Freedom
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		vector ed(n,vector<int>(n));
		function<void(int,int)> dfs=[&](int x,int y)
			{
				if (!av(x,y)||ed[x][y]) return;
				ed[x][y]=1;
				if (a[x][y]!=' ') return;
				for (int k=0; k<4; k++) dfs(x+dx[k],y+dy[k]);
			};
		for (i=0; i<n; i++)
		{
			dfs(i,0); dfs(0,i);
			dfs(i,n-1); dfs(n-1,i);
		}
		int cnt=0;
		for (i=0; i<n; i++) for (j=0; j<n; j++) cnt+=ed[i][j]&&a[i][j]!=' ';
		ans+=cnt*7;
		if (dbg) cerr<<"Freedom: "<<cnt<<' '<<ans<<endl;
	}
	{//Chupacabra
		const static int dx[8]={1,-1,1,-1,2,2,-2,-2};
		const static int dy[8]={2,2,-2,-2,1,-1,1,-1};
		vector ed(n,vector<int>(n));
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]=='!') for (l=0; l<8; l++)
		{
			int x=i+dx[l],y=j+dy[l];
			if (!av(x,y)) continue;
			ed[x][y]=1;
		}
		int cnt=0;
		for (i=0; i<n; i++) for (j=0; j<n; j++)
			cnt+=(a[i][j]=='D'||a[i][j]=='v')&&ed[i][j];
		ans+=cnt*200;
		if (dbg) cerr<<"Chupacabra: "<<cnt<<' '<<ans<<endl;
	}
	{//Peaks
		ll cnt=0;
		vector<pair<int,int>> peak;
		for (i=0; i<n; i++) for (j=0; j+1<n; j++) if (a[i].substr(j,2)=="/\\")
			peak.push_back({i,j});
		for (auto [x1,y1]:peak)
		{
			int mx=0;
			for (auto [x2,y2]:peak) cmax(mx,abs(x1-x2)+abs(y1-y2));
			cnt+=mx;
		}
		ans+=cnt*50;
		if (dbg) cerr<<"Peaks: "<<cnt<<' '<<ans<<endl;
	}
	{//Drake/grill
		int cnt=0;
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]=='D') for (k=0; k<4; k++)
		{
			int x=i+dx[k],y=j+dy[k];
			if (av(x,y)&&a[x][y]=='G')
			{
				++cnt;
				break;
			}
		}
		ans+=cnt*500;
		if (dbg) cerr<<"Drake/grill: "<<cnt<<' '<<ans<<endl;
	}
	{//Minimum frequency
		vector<int> cnt(256);
		for (auto &v:a) for (char c:v) ++cnt[c];
		vector<int> mns;
		for (char c:"*^!/\\vDG"s) if (cnt[c]) mns.push_back(cnt[c]);
		int mn=*min_element(all(mns));
		ll cc=0;
		for (ll x:mns) if (x==mn) cc+=x;
		ans+=cc*10;
		if (dbg) cerr<<"Minimum frequency: "<<cc<<' '<<ans<<endl;
	}
	{//Empty fields
		int cnt=0;
		for (auto &v:a) cnt+=count(all(v),' ');
		ans+=cnt*1;
		if (dbg) cerr<<"Empty fields: "<<cnt<<' '<<ans<<endl;
	}
	{//Animals 2
		vector<int> cnt(256);
		for (auto &v:a) for (char c:v) ++cnt[c];
		int cc=cnt['!']*cnt['v']*cnt['D'];
		ans+=1*cc;
		if (dbg) cerr<<"Animals 2: "<<cc<<' '<<ans<<endl;
	}
	{//House view down
		int cnt=0;
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]==' ')
		{
			for (k=i-1; k>=0; k--) if (a[k][j]!=' ')
			{
				cnt+=a[k][j]=='^';
				break;
			}
		}
		// ans+=cnt*15;
		if (dbg) cerr<<"House view down: "<<cnt<<' '<<ans<<endl;
	}
	{//Drake/grill
		int cnt=0;
		const static int dx[4]={0,1,-1,0};
		const static int dy[4]={1,0,0,-1};
		for (i=0; i<n; i++) for (j=0; j<n; j++) if (a[i][j]=='G') for (k=0; k<4; k++)
		{
			int x=i+dx[k],y=j+dy[k];
			if (av(x,y)&&a[x][y]=='D')
			{
				++cnt;
				break;
			}
		}
		ans+=cnt*50;
		if (dbg) cerr<<"Drake/grill: "<<cnt<<' '<<ans<<endl;
	}
	{//Houses and grills
		int cc=0;
		vector<int> cnt(256);
		for (auto &v:a) for (char c:v) ++cnt[c];
		cc=min(cnt['^'],cnt['G']);
		ans+=3*cc;
		if (dbg) cerr<<"Houses and grills: "<<cc<<' '<<ans<<endl;
	}
	//sun *
	//house ^
	//chupacabra !
	//left slope /
	//right slope \ 
	//bird v
	//drake D
	//grill G
	cout<<ans<<endl;
}
/*
suns: 9 900
biggest bird: 2 1900
Flock perimeter: 22 3220
House view up: 0 3220
Animals 1: 0 3269
Freedom: 30 3479
Chupacabra: 0 3479
Peaks: 56 6279
Drake/grill: 9 10779
Minimum frequency: 72 11499
Empty fields: 9 11508
Animals 2: 729 12237
House view down: 0 12237
Drake/grill: 9 12687
Houses and grills: 9 12714

suns: 0 0
biggest bird: 2 1000
Flock perimeter: 8 1480
House view up: 0 1480
Animals 1: 8 1601
Freedom: 3 1622
Chupacabra: 2 2022
Peaks: 0 2022
Drake/grill: 0 2022
Minimum frequency: 0 2022
Empty fields: 6 2028
Animals 2: 1 2029
House view down: 0 2029
Drake/grill: 0 2029
Houses and grills: 0 2029

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

input:

2
 /
^G

output:

70

result:

ok single line: '70'

Test #2:

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

input:

3
^v*
 v/
/ v

output:

2017

result:

ok single line: '2017'

Test #3:

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

input:

3
v  
\D^
^/\

output:

1607

result:

ok single line: '1607'

Test #4:

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

input:

3
*D*
/G 
\/!

output:

2003

result:

ok single line: '2003'

Test #5:

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

input:

3
G G
D \
/!*

output:

1722

result:

ok single line: '1722'

Test #6:

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

input:

9
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG
 *^!/\vDG

output:

12672

result:

ok single line: '12672'

Test #7:

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

input:

3
***
***
***

output:

147

result:

ok single line: '147'

Test #8:

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

input:

3
!!!
*!!
!!!

output:

567

result:

ok single line: '567'

Test #9:

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

input:

3
 v 
vvv
 v 

output:

2423

result:

ok single line: '2423'

Test #10:

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

input:

3
 v 
 v 
 v 

output:

1128

result:

ok single line: '1128'

Test #11:

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

input:

3
   
vvv
   

output:

2128

result:

ok single line: '2128'

Test #12:

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

input:

3
 D 
DDD
 D 

output:

2423

result:

ok single line: '2423'

Test #13:

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

input:

3
 D 
vDv
 D 

output:

2393

result:

ok single line: '2393'

Test #14:

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

input:

3
v v
   
D D

output:

3154

result:

ok single line: '3154'

Test #15:

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

input:

3
   
   
   

output:

10

result:

ok single line: '10'

Test #16:

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

input:

3
v  
 D 
  !

output:

1659

result:

ok single line: '1659'

Test #17:

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

input:

3
! !
   
 v 

output:

1083

result:

ok single line: '1083'

Test #18:

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

input:

3
! !
   
 D 

output:

1083

result:

ok single line: '1083'

Test #19:

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

input:

3
/\ 
   
 /\

output:

374

result:

ok single line: '374'

Test #20:

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

input:

3
GD 
 G 
   

output:

1393

result:

ok single line: '1393'

Test #21:

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

input:

3
DG 
 D 
   

output:

2628

result:

ok single line: '2628'

Test #22:

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

input:

3
 *^
 /\
vDG

output:

2350

result:

ok single line: '2350'

Test #23:

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

input:

3
   
   
   

output:

10

result:

ok single line: '10'

Test #24:

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

input:

3
G^^
G^^
G^G

output:

109

result:

ok single line: '109'

Test #25:

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

input:

5
/*G\ 
 D^*v
  */D
!/!* 
 D^D*

output:

4946

result:

ok single line: '4946'

Test #26:

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

input:

10
///\*/G*^\
 ^*/*!\//G
G\/ GG/ D/
//\vDv!D! 
!G*D*Gv/vv
D G/D*D/D\
/v!v^DG \v
v^v/^/v*v\
G!G /v*v^G
//^^vv/G^/

output:

25134

result:

ok single line: '25134'

Test #27:

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

input:

15
 !\*\v/^\GD G^\
DDD^G!^\G^^! *G
 D^  vDv \G/Gvv
^!**\^\!*^ vD/\
G\GG/G/ *vvv\vG
 !/\\^/\*/ !D*G
 ^^^*\ G\G^D^ !
*\\/G G\ D^/*\!
^v^! \/ GDD^!/*
v/\\D!/ ^ ^ DG/
/ /G^G\ /*//\ *
!/*G*!/v!!GG*GG
!^G^G G^  vvvDv
D^!!\ GGG/*\\^/
^Dv^vDv/*\^^!GD

output:

54923

result:

ok single line: '54923'

Test #28:

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

input:

20
^^vv/*v/  *^^D*//GGv
/GvGDGDG*v\/Dv^^/DG\
/ v DvD*DDD /DD!v\^ 
G\^ v/GG!!!v^G*G D\v
\!v^*!/**/*!!v!/\//D
v!/ \v\vv D !vv\*D!^
DD\*/Gv/*GGD^DD!v!*G
\Dv!^*^Gv !^!D\ !D!!
*^D!^D\/*!!/DDD!\^DD
 v^\\\v G \/Gv/^!^!\
!Gv/**G\*!\DG^ /GDv\
/^\G!/D G ^ !*Dv G^*
\D^\^\*\ ^v^ G*!GDDD
\ !\!G\ D*G\G! ^v^vv
/ !...

output:

263008

result:

ok single line: '263008'

Test #29:

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

input:

25
/v/ ^G*D ! \*v^v  D/*! \v
^^*! /!G*\/G/\G/vDG*\  Dv
GG *GG^DD\v/* /! GG /!DDD
/D!^vv/!!\\ !//!^/D*!*vv\
vG\DGD!/*DD ^DG/v/^Gv   !
!/!!/\\*!!!/Gv *\G^ G^G G
 /G/^!v/\v\G /!\GG//^ \D^
\/^* vv!*Gv^**!**Gv\^G*/!
Gv*/\!  v\!^\*/DD^ GvGv! 
//*v!!vD^ \\D*GG\vv!!*GD/
G\!D*\*^//^ !\D!D\\  v/!/
GGG\*v\* !^...

output:

476332

result:

ok single line: '476332'

Test #30:

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

input:

30
 !!\^*DDG!^v *!^^D*vD^!*!D^/G\
/v*GGD!*v//!!v!^^G/GD!!G D*\\D
!^ ^ /\*/\!/ *^ vv/*D!\ ^ \ !v
/Gvv^  /D *  !D**vv/v!* ! D vG
\v!D\*/D* vD \GG\^ v^ ^^v^/\!^
 ^G G/v!\/ vv/! D!!^vG*/*v/D D
**  *\ DDGDG*/v^^ !*/ ^^/*/G^!
^*^GD*D*/*GD/\  ^//\\**GD*GGvD
^G^ DD^DD^* vv**v D/vG*/DG*///
/^DG^v/*/v**^ *!^\...

output:

1223508

result:

ok single line: '1223508'

Test #31:

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

input:

35
*Dvv*D!G *v\/ **\!/G\*v *\\v \!Dv^*
^* !\vG!GD/*^\^/\//^ D*GGG^GG*!G*  
\vD/G!*^/D!\\ !vvD **D\/ v/\v^GvDD*
\^^G/G*!*G^D^D*DG^ /^^*\!*DDvv!/ ^^
^\vv/\Dv!GG!*\\v!!GD!GGGDDG\\v*^!\/
 v//! //G v ^^GDG^**D*D\DD\*^ *^^/v
GGGvDG\D/v!   \ *!D! G//D\!^ v^GD/D
v\!^ \!v*/^vG*GD^D/\/vD/\**^  G^DGv
 ^ ^vvD G...

output:

2548495

result:

ok single line: '2548495'

Test #32:

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

input:

40
*DvG**G^/ !^G^ ^\\/v!GD Dv  vv!DD*/*G!!!
v\vD!G/G^vG*D^\*^!\/** D*!D/\**! **/\^  
*D/G\D v^v!/^GG^v^Gv*G\G *\  GGD  G/D!G*
/v! ^/G \/GDvv vvG\\^D v^!*G!DD/*v/*vD/D
v*D/G!\*^!*G/\v^ /Dv *v!!DvD*!\GG/!G//v/
DG*^v/^!/\^D\\G//\*DDG v \^^ v *D\v!^D!v
!^*!G\  *D*^v*\D/*^G^\D!!D* !!^//*/vv G^
GG!!****\D...

output:

6207683

result:

ok single line: '6207683'

Test #33:

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

input:

45
!D*/^v/^^/!**Gv/G\^D* */vD^vDD Gv\*!! /* D\\v
//vv**vv v^!!v*^**v\!\G *^ *G*//D vDvGG^*G!!^
/v^* *DD!!^G^^v^/ ^^vDDG/Dv\v*\\v!/*  * /^/D*
!GDD*\v!DD^/G/^^Gv* ^DG/G\GD\D\G  ^\*/ ^/D*D 
v*\\!G\*v^  !^^*//\*/^D!^v\\ G\^*^ D/**!GGG/G
v  GD v\ \^DvG*\ ^!\ !^\*/DvGv\ G*G ^^GDv^/^ 
!GDv* \D!**!!\ /G/G ^...

output:

12283068

result:

ok single line: '12283068'

Test #34:

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

input:

50
D*^\G/*/G\GDD !!\v\vDDv^!D\*//**v//\\\/// v\G^Gv\v
*D/\\ vv\Gv/\/G!/*!vG!/^\//!*\!^!^^v**!G*DG\G/ G^ 
\ /D*D*/!\!^^ ^ v^\\D\ !\* ^vG!/\v/*Gv\D^* !Gv\v/ 
v\ * DvG\!! ! /\ */G /^ G!^! * \^vG^D\ \v*//DD!* !
D/^D^GvG //*v !^^ /^!!\ Gvv^G!vDv/G*/D* ^\\^ v!*!\
DDG*D\^*\/ \!\ ^^DG\\vG!*! \Gvv*/^D\G\ /^/...

output:

20833314

result:

ok single line: '20833314'

Test #35:

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

input:

50
*                        D                       *
 *                       D                      * 
  *                      D                     *  
   *                     D                    *   
    *                    D                   *    
     *                   D                ...

output:

54097

result:

ok single line: '54097'

Test #36:

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

input:

50
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

63373

result:

ok single line: '63373'

Test #37:

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

input:

50
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D                                                 
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
                                                 D
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D                                         ...

output:

237418

result:

ok single line: '237418'

Test #38:

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

input:

50
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
v                                                v
v vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v
v v                                            v v
v v vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv v v
v v v                                     ...

output:

376604

result:

ok single line: '376604'

Test #39:

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

input:

50
                                                  
                                                  
                                                  
                                                  
                                                  
                                          ...

output:

40052

result:

ok single line: '40052'

Test #40:

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

input:

50
!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D
Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv
v!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!
!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D
Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv
v!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!Dv!D...

output:

579291261

result:

ok single line: '579291261'

Test #41:

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

input:

50
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\...

output:

4618874

result:

ok single line: '4618874'

Test #42:

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

input:

50
GGGDGGDGDDGDDDDDDDGGDDDDGDGDGGDDDDDDGGDDGDGDDDDGGG
DDGGDGGDDDGDGDDDDGGDGDDDDGGDDGGGGGDGDDGDDGGDGGGGGD
GDDGGGDGDGGDDGGGGDDDGDDDDDGGDGDGGDDGDDDGGGDGGDGGDD
GGGDDGDGGDGGGGGGDGDGGDDDGGGDGDDGGGDDDGDDGDDGDDGDGG
GDGDGGGGDDGGGDDGGDDGGGDDGGDDGDDGGGDDGDDGGDDDGGGGGG
GGDGGGGDDGGGDGGGDDGGGGDDGGGGGGDGGDGDDGGGDG...

output:

1006558

result:

ok single line: '1006558'

Test #43:

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

input:

50
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

output:

1491874

result:

ok single line: '1491874'

Test #44:

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

input:

50
                                                  
                                                  
                                                  
                                                  
                                                  
                                          ...

output:

2501

result:

ok single line: '2501'

Test #45:

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

input:

50
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
G^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
G^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^GG^
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

output:

5138

result:

ok single line: '5138'

Test #46:

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

input:

50
                                                  
 D^ DD /v ^^ GG DD \/ Gv GD !/ \\ !D /  ^v !/ /! \
                                                  
                                                  
                                                  
                                          ...

output:

404545

result:

ok single line: '404545'

Test #47:

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

input:

50
/*D/!^^v\^^\\^D**GD\\DGG\/^/vG!D!\/!D^GD*\\vD/GvG\
^**/^\!*/*D!Dv*/\*!^^!\v\^Gv/*^G\GG//G^v!*!!D^^v/v
                                                  
!G*G\G!!!vv^\vG*GvDG*\D/^D/^/D/v*\!*!!GG/!G\DG^*D\
v*G*v*//*!!\/!^\\^**^DGDDG!v!DDv^\!/DGvv/\\/^\DDG*
                                          ...

output:

10613183

result:

ok single line: '10613183'

Test #48:

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

input:

50
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D                                                D
D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D
D D                                            D D
D D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD D D
D D D                                     ...

output:

240349

result:

ok single line: '240349'

Test #49:

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

input:

50
/D \v *! G\ v! Gv ^v D^ ^G DD ^^ !/ */ G^ ^! D* \D
!! \/ \! ^^ *^ G! !^ G/ *\ !^ \D v! */ GG DD vD *v
                                                  
G! Gv *D \^ !^ D^ vG GD ^! G^ \! !* *v *G D^ !^ *v
v^ !\ ^^ /! v* G/ \v G/ D! v* // ^! v* !\ \/ */ !/
                                          ...

output:

3630584

result:

ok single line: '3630584'

Test #50:

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

input:

3
!  
  v
 D 

output:

2059

result:

ok single line: '2059'