QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#344700#2474. Art TransactionPetroTarnavskyiAC ✓1ms4016kbC++206.2kb2024-03-04 22:20:022024-03-04 22:20:02

Judging History

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

  • [2024-03-04 22:20:02]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4016kb
  • [2024-03-04 22:20:02]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int N = 55;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const vector<PII> knightMoves = {{1, 2}, {1, -2}, {-1, 2}, {-1, -2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}};

int n;
string s[N];
bool illuminated[N][N];
bool g[N][N]; // for dfs
int flockIdx[N][N];
int connectedToBorder[N][N];
int width[N * N];

bool ok(int i, int j)
{
	return 0 <= i && i < n && 0 <= j && j < n;
}

void dfs(int i, int j, int used[N][N])
{
	FOR(k, 0, 4)
	{
		int ni = i + dx[k], nj = j + dy[k];
		if (ok(ni, nj) && g[ni][nj] && used[ni][nj] == -1)
		{
			used[ni][nj] = used[i][j];
			dfs(ni, nj, used);
		}
	}
}

void calcWidth(int i, int j, int di, int dj)
{
	int w = 0;
	while (ok(i, j))
	{
		int fl = flockIdx[i][j];
		if (fl == -1)
			w = 0;
		else
		{
			w++;
			width[fl] = max(width[fl], w);
		}
		i += di;
		j += dj;
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	getline(cin, s[0]);
	FOR(i, 0, n)
		getline(cin, s[i]);
	LL ans = 0;
	// suns
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (s[i][j] != '*')
				continue;
			FOR(di, -1, 2)
			{
				FOR(dj, -1, 2)
				{
					int r = i + di, c = j + dj;
					while (ok(r, c) && s[r][c] == ' ')
					{
						r += di;
						c += dj;
					}
					if (ok(r, c) && s[r][c] != '*')
						illuminated[r][c] = true;
				}
			}
		}
	}
	FOR(i, 0, n)
		FOR(j, 0, n)
			if (illuminated[i][j])
				ans += 100;
	cerr << "suns " << ans << '\n';
	// birds
	FOR(i, 0, n)
		FOR(j, 0, n)
		{
			flockIdx[i][j] = -1;
			g[i][j] = s[i][j] == 'v' || s[i][j] == 'D';
		}
	int flocks = 0;
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (g[i][j] && flockIdx[i][j] == -1)
			{
				flockIdx[i][j] = flocks++;
				dfs(i, j, flockIdx);
			}
		}
	}
	FOR(i, 0, n)
	{
		// horizontal
		calcWidth(i, 0, 0, 1);
		// vertical
		//calcWidth(0, i, 1, 0);
		// diagonal
		//calcWidth(i, 0, 1, 1);
		//calcWidth(0, i, 1, 1);
		//calcWidth(i, 0, -1, 1);
		//calcWidth(n - 1, i, -1, 1);
	}
	FOR(i, 0, flocks)
		ans += 500 * width[i];
	cerr << "birgs " << ans << "\n";
	// flock perimeter
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (g[i][j])
			{
				FOR(k, 0, 4)
				{
					int ni = i + dx[k], nj = j + dy[k];
					if (!ok(ni, nj) || !g[ni][nj])
						ans += 60;
				}
			}
		}
	}
	cerr << "flock perimeter " << ans << "\n";
	#warning
	// house view up and down
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (s[i][j] == '^')
			{
				// up
				for (int k = i - 1; k >= 0 && s[k][j] == ' '; k--)
				{
					ans += 15;
				}
				//// down
				//for (int k = i + 1; k < n && s[k][j] == ' '; k++)
				//{
				//	ans += 5;
				//}
			}
		}
	}
	cerr << "house " << ans << '\n';
	// 3x3 blocks
	set<string> uniqueBlocks;
	FOR(i, 0, n - 2)
	{
		FOR(j, 0, n - 2)
		{
			string t;
			FOR(ii, i, i + 3)
			{
				FOR(jj, j, j + 3)
				{
					t += s[ii][jj];
				}
			}
			uniqueBlocks.insert(t);
		}
	}
	ans += SZ(uniqueBlocks);
	cerr << "blocks " << ans << "\n";
	// animals i
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (s[i][j] != '!' && s[i][j] != 'v' && s[i][j] != 'D')
			{
				continue;
			}
			FOR(k, 0, 4)
			{
				int ni = i + dx[k], nj = j + dy[k];
				if (ok(ni, nj) && s[ni][nj] == ' ')
					ans += 15;
			}
		}
	}
	cerr << "animals1 " << ans << "\n";
	// freedom
	FOR(i, 0, n)
		FOR(j, 0, n)
			g[i][j] = s[i][j] == ' ';
	FOR(i, 0, n)
		FOR(j, 0, n)
		{
			connectedToBorder[i][j] = -1;
		}
	FOR(i, 0, n)
		FOR(j, 0, n)
			if ((i == 0 || i == n - 1 || j == 0 || j == n - 1) && g[i][j] && connectedToBorder[i][j] == -1)
			{
				connectedToBorder[i][j] = 1;
				dfs(i, j, connectedToBorder);
			}
	FOR(i, 0, n)
		FOR(j, 0, n)
		{
			if (s[i][j] == ' ')
				continue;
			bool freedom = (i == 0 || i == n - 1 || j == 0 || j == n - 1);
			FOR(k, 0, 4)
			{
				int ni = i + dx[k], nj = j + dy[k];
				freedom |= ok(ni, nj) && (connectedToBorder[ni][nj] == 1);
			}
			if (freedom)
			{
				ans += 7;
			}
		}
	cerr << "freedom " << ans << "\n";
	// chupakabra
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (s[i][j] != 'v' && s[i][j] != 'D')
			{
				continue;
			}
			bool can = false;
			for (auto [kdx, kdy] : knightMoves)
			{
				int ni = i + kdx, nj = j + kdy;
				can |= ok(ni, nj) && s[ni][nj] == '!';
			}
			if (can)
				ans += 200;
		}
	}
	cerr << "chupakabra " << ans << '\n';
	// peaks
	vector<PII> peaks;
	FOR(i, 0, n)
		FOR(j, 0, n - 1)
		{
			if (s[i][j] == '/' && s[i][j + 1] == '\\')
				peaks.PB({i, j});
		}
	for (auto [i1, j1] : peaks)
	{
		int mx = 0;
		for (auto [i2, j2] : peaks)
		{
			int d = abs(i2 - i1) + abs(j2 - j1);
			if (d != 0)
				mx = max(mx, d);
		}
		ans += 50 * mx;
	}
	
	cerr << "peaks " << ans << '\n';
	// drake/grill and grill/drake
	vector<tuple<char, char, int>> drakeGrill = {{'D', 'G', 500}, {'G', 'D', 50}};
	
	for (auto [c1, c2, score] : drakeGrill)
	{
		FOR(i, 0, n)
		{
			FOR(j, 0, n)
			{
				if (s[i][j] != c1)
					continue;
				bool can = false;
				FOR(k, 0, 4)
				{
					int ni = i + dx[k], nj = j + dy[k];
					can |= ok(ni, nj) && s[ni][nj] == c2;
				}
				if (can)
					ans += score;
			}
		}
	}
	cerr << "D + G " << ans << '\n'; 
	// minimum frequency
	map<char, int> cnt;
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			cnt[s[i][j]]++;
		}
	}
	int mn = n * n + 1;
	for (auto [c, cn] : cnt)
		if (c != ' ')
			mn = min(mn, cn);
	if (mn <= n * n)
	{
		for (auto [c, cn] : cnt)
			if (c != ' ' && cn == mn)
				ans += 10 * cn;
	}
	cerr << "freak " << ans << '\n';
	// empty fields
	ans += cnt[' '];
	cerr << "empty " << ans << '\n';
	// animals ii
	ans += (LL)cnt['!'] * cnt['v'] * cnt['D'];
	cerr << "animal2 " << ans << '\n';
	ans += 3 * min(cnt['^'], cnt['G']);
	cerr << "House + G " << ans << '\n';
	cout << ans << "\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

2
 /
^G

output:

70

result:

ok single line: '70'

Test #2:

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

input:

3
^v*
 v/
/ v

output:

2017

result:

ok single line: '2017'

Test #3:

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

input:

3
v  
\D^
^/\

output:

1607

result:

ok single line: '1607'

Test #4:

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

input:

3
*D*
/G 
\/!

output:

2003

result:

ok single line: '2003'

Test #5:

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

input:

3
G G
D \
/!*

output:

1722

result:

ok single line: '1722'

Test #6:

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

input:

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

output:

12672

result:

ok single line: '12672'

Test #7:

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

input:

3
***
***
***

output:

147

result:

ok single line: '147'

Test #8:

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

input:

3
!!!
*!!
!!!

output:

567

result:

ok single line: '567'

Test #9:

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

input:

3
 v 
vvv
 v 

output:

2423

result:

ok single line: '2423'

Test #10:

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

input:

3
 v 
 v 
 v 

output:

1128

result:

ok single line: '1128'

Test #11:

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

input:

3
   
vvv
   

output:

2128

result:

ok single line: '2128'

Test #12:

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

input:

3
 D 
DDD
 D 

output:

2423

result:

ok single line: '2423'

Test #13:

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

input:

3
 D 
vDv
 D 

output:

2393

result:

ok single line: '2393'

Test #14:

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

input:

3
v v
   
D D

output:

3154

result:

ok single line: '3154'

Test #15:

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

input:

3
   
   
   

output:

10

result:

ok single line: '10'

Test #16:

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

input:

3
v  
 D 
  !

output:

1659

result:

ok single line: '1659'

Test #17:

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

input:

3
! !
   
 v 

output:

1083

result:

ok single line: '1083'

Test #18:

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

input:

3
! !
   
 D 

output:

1083

result:

ok single line: '1083'

Test #19:

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

input:

3
/\ 
   
 /\

output:

374

result:

ok single line: '374'

Test #20:

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

input:

3
GD 
 G 
   

output:

1393

result:

ok single line: '1393'

Test #21:

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

input:

3
DG 
 D 
   

output:

2628

result:

ok single line: '2628'

Test #22:

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

input:

3
 *^
 /\
vDG

output:

2350

result:

ok single line: '2350'

Test #23:

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

input:

3
   
   
   

output:

10

result:

ok single line: '10'

Test #24:

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

input:

3
G^^
G^^
G^G

output:

109

result:

ok single line: '109'

Test #25:

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

input:

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

output:

4946

result:

ok single line: '4946'

Test #26:

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

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: 3700kb

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: 1ms
memory: 3876kb

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: 3740kb

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: 3732kb

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: 3980kb

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: 1ms
memory: 3972kb

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: 3816kb

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: 3800kb

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: 3580kb

input:

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

output:

54097

result:

ok single line: '54097'

Test #36:

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

input:

50
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

63373

result:

ok single line: '63373'

Test #37:

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

input:

50
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D                                                 
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
                                                 D
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D                                         ...

output:

237418

result:

ok single line: '237418'

Test #38:

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

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: 3724kb

input:

50
                                                  
                                                  
                                                  
                                                  
                                                  
                                          ...

output:

40052

result:

ok single line: '40052'

Test #40:

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

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: 0ms
memory: 3876kb

input:

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

output:

4618874

result:

ok single line: '4618874'

Test #42:

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

input:

50
GGGDGGDGDDGDDDDDDDGGDDDDGDGDGGDDDDDDGGDDGDGDDDDGGG
DDGGDGGDDDGDGDDDDGGDGDDDDGGDDGGGGGDGDDGDDGGDGGGGGD
GDDGGGDGDGGDDGGGGDDDGDDDDDGGDGDGGDDGDDDGGGDGGDGGDD
GGGDDGDGGDGGGGGGDGDGGDDDGGGDGDDGGGDDDGDDGDDGDDGDGG
GDGDGGGGDDGGGDDGGDDGGGDDGGDDGDDGGGDDGDDGGDDDGGGGGG
GGDGGGGDDGGGDGGGDDGGGGDDGGGGGGDGGDGDDGGGDG...

output:

1006558

result:

ok single line: '1006558'

Test #43:

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

input:

50
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

output:

1491874

result:

ok single line: '1491874'

Test #44:

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

input:

50
                                                  
                                                  
                                                  
                                                  
                                                  
                                          ...

output:

2501

result:

ok single line: '2501'

Test #45:

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

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: 3712kb

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: 3748kb

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: 3952kb

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: 3868kb

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: 1ms
memory: 3552kb

input:

3
!  
  v
 D 

output:

2059

result:

ok single line: '2059'