QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#857004#9970. Looping RPSucup-team191#AC ✓678ms279916kbC++232.9kb2025-01-14 22:57:082025-01-14 22:57:09

Judging History

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

  • [2025-01-14 22:57:09]
  • 评测
  • 测评结果:AC
  • 用时:678ms
  • 内存:279916kb
  • [2025-01-14 22:57:08]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define X first
#define y second
#define Y second
#define pb push_back
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

const int N = 1e5 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
const int BS = 5;
const char en='\n';
const ll LLINF=1ll<<60;
const int OFF = (1 << 18);

inline int add(int A, int B) {
	if(A + B >= MOD) return A + B - MOD;
	return A + B;
}

inline int sub(int A, int B) {
	if(A - B < 0) return A - B + MOD;
	return A - B;
}

inline int mul(int A, int B) {
	return (ll)A * B % MOD;
}

int n, pot[N], pot2[40];
string s[N];
vi hsh[N][30];

int lcp(int i, int j) {
	if(hsh[i][29][0] == hsh[j][29][0]) return INF;
	if(s[i][0] != s[j][0]) return 0;
	int ans = 0;
	int pi = 0, pj = 0;
	for(int k = 29;k >= 0;k--) {
		if(hsh[i][k][pi] == hsh[j][k][pj]) {
			pi = (pi + (1 << k)) % (int)s[i].size();
			pj = (pj + (1 << k)) % (int)s[j].size();
			ans += (1 << k);
		}
	}
	return ans;
}

bool cmp(int i, int j) {
	int lc = lcp(i, j);
	if(lc == INF) return i < j;
	return s[i][lc % (int)s[i].size()] < s[j][lc % (int)s[j].size()];
}

int encode(char c) {
	if(c == 'K') return 1;
	if(c == 'N') return 2;
	return 3;
}

int T[2 * OFF], val[N];

int miin(int A, int B) {
	return val[B] < val[A] ? B : A;
}

int query(int i, int a, int b, int lo, int hi) {
	if(lo <= a && b <= hi) return T[i];
	if(a > hi || b < lo) return 0;
	return miin(query(2 * i, a, (a + b) / 2, lo, hi), query(2 * i + 1, (a + b) / 2 + 1, b, lo, hi));
}

ll solve(int l, int r) {
	if(l > r - 1) return 0;
	int mid = query(1, 0, OFF - 1, l + 1, r);
	if(val[mid] == INF) return 0;
	int mid2 = query(1, 0, OFF - 1, mid + 1, r);
	if(val[mid] != val[mid2])
		return solve(l, mid - 1) + solve(mid, r);
	return solve(l, mid - 1) + solve(mid, mid2 - 1) + solve(mid2, r) +
			(ll)(mid - l) * (mid2 - mid) * (r - mid2 + 1);
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); pot[0] = 1; pot2[0] = BS;
	for(int i = 1;i < N;i++) {
		pot[i] = mul(pot[i - 1], BS);
	}
	for(int i = 1;i < 40;i++)
		pot2[i] = mul(pot2[i - 1], pot2[i - 1]);
	cin >> n;
	vector < int > sve(n);
	for(int i = 0;i < n;i++) {
		cin >> s[i]; sve[i] = i;
		int m = (int)s[i].size();
		for(int j = 0;j < 30;j++) hsh[i][j].resize(m);
		for(int j = 0;j < m;j++) {
			hsh[i][0][j] = encode(s[i][j]);
		}
		for(int j = 1;j < 30;j++) {
			for(int l = 0;l < m;l++) {
				int nxt = (l + (1 << (j - 1))) % m;
				hsh[i][j][l] = add(hsh[i][j - 1][l], mul(pot2[j - 1], hsh[i][j - 1][nxt]));
			}
		}
	}
	sort(sve.begin(), sve.end(), cmp);
	for(int i = 1;i < n;i++) val[i] = lcp(sve[i], sve[i - 1]), T[OFF + i] = i;
	for(int i = OFF - 1; i ; i--) T[i] = miin(T[2 * i], T[2 * i + 1]);
	val[0] = INF;
	cout << solve(0, n - 1) << endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 10708kb

input:

6
P
PN
KK
N
PKK
PN

output:

6

result:

ok 1 number(s): "6"

Test #2:

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

input:

10
KKKNP
KNKPPKNK
KNKPP
KNKPPKN
KKKN
NNKNNNKNNNKNNNKNNNKNNNKNNNKNNPN
NNKN
NPPN
NNKNNNKNNNKNNNKNNNKNNNKNNNK
KKKNN

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

10
NNNPNNNPNNNPNNNK
KKN
NNNP
KKP
NNNPNNNPNNNPN
KKNKKNKKPN
KNNPNPNKKKNPPKNKKKNKNKKNKPPPNKKPKP
KKPK
KKNKKNK
KKPKKN

output:

3

result:

ok 1 number(s): "3"

Test #4:

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

input:

10
K
PPPNNPPPNNPPPNNPPPNNPPPNNPPPNNPPPNNPPPNNP
PPKP
PPPNNPPPNNPPPNNPPPNNPPPNNPPPNNPPPNNPPPNNPPPK
P
K
N
P
PPPNN
N

output:

25

result:

ok 1 number(s): "25"

Test #5:

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

input:

10
NPNKP
NNNNKNNNNPP
PPKPNNNNPNKKKN
NPNKPNP
NNNNKN
NNNNK
NKNPKKPNPKKNPNKN
NKNPKKPNPKKNPNK
NKNPKKPNPKKNP
NPNKPNPN

output:

30

result:

ok 1 number(s): "30"

Test #6:

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

input:

10
KPKKPKKPKKPKKP
KPKKPKKPKKPKKPKNK
PNPNP
KPK
PN
NPNPNNPNPNK
NKKPKKPKPPKKPKKKKPKNKPPKPPNKNP
NPNPNNP
PNPNPK
NPNPN

output:

39

result:

ok 1 number(s): "39"

Test #7:

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

input:

4
KKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPK
NN
KKP
KKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKNK

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

7
KPKN
KPKNKPKNKPKNKPKK
NKPPNNNPKKNN
KPPKPKPPKPKPPKPKPPKPKPP
KPKNKPKNKPKNKP
KPPKP
KPPKPKPPKPKPPKPKPPKPKPPKPN

output:

2

result:

ok 1 number(s): "2"

Test #9:

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

input:

10
NKNNKNKN
KPKN
PKPN
PNNNNNNKKNNPNNKNPPKPPNPNPPKKKPNNNPNPKKNK
PKPNPKP
PKPNPK
KPKNKP
NKNNKNKNNKNPN
KPKNKPK
NKNNK

output:

39

result:

ok 1 number(s): "39"

Test #10:

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

input:

300
NKNPNK
NKKNKK
KPPNPN
KKPNKNK
PKKNPKP
KPKPPPN
NNKPPNN
NPKPPKN
KNNKKPK
PPPNPKK
NKPKNP
KPKNNPP
NNPKNP
PNPPPKN
PKKPNP
PPNNKK
PKNKNK
PKNPNK
NKNPNPP
KNKNNPN
NKPPPPK
NNPPKKN
KNKKNPK
KKNNPKN
PPPKNK
NPPPPPP
NKKPKPP
KNKNPPK
KPKPNNK
NPNNKN
PNPNKP
PNPKKP
KKKKPKN
NNNKNPK
NPNKPNK
NNNKNK
PPKKNKP
NNNKPPK
KPNKPP...

output:

1102940

result:

ok 1 number(s): "1102940"

Test #11:

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

input:

91
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKN
KKKKKKKKP
PNPKPPNP
KKKN
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKN
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKP
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKN
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKP
KKKKKKKKKKKKKKKKKKKKKKN
KKKKKKKN
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKP
KKKKKKKKKKKKP
...

output:

2151

result:

ok 1 number(s): "2151"

Test #12:

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

input:

72
PKPPKPPKPPKPPKPPN
PKP
NNNNNK
NPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNPNNP
NNPNNPNNPNNPNNPNNK
NP
PPPPPPN
PKPPKPPKPPKPPKPP
PPPPKPP
PPK
NNNNNPP
NNNNPNNNNPNNNNPN
KPNNNKKPPKPKKNPPKKNNKPKPKPKPPPKPPKPNNKPPKPPPNNNKKNNPKKKKKN...

output:

14794

result:

ok 1 number(s): "14794"

Test #13:

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

input:

91
PKKK
KKKNKKKKNKKKKNKK
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPKP
PPPPNPPPPNPPPPNPPPPNPPPPK
PPPPNNPPPPPNNPPPPPNNPPPPPNNPPPPK
NKNKNKNKN
PNPPNPKPPNPPN
NPKNPKNPKNPKNPKNPKNPKNPKNP
PNPPNPKPPNP
KKPK
KKKKKNKKKKKKNKKKKKPN
NPK
PPNKPPKPPNKPPPNKPPK
KKP
PNPPNPPNPPNPKK
PPPPPPNPPPPPPNPPPPPPNPPPPPPK
PPPPPPNPPP...

output:

24738

result:

ok 1 number(s): "24738"

Test #14:

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

input:

130
PKPKPKPKPNPKPKPKPKPKPN
NPNPNPNPN
N
PNKPNKP
PNKPK
NNNNKNNNNPPNNNNKNNNNNKNNNNPP
NNNNNNNNKNNNNNNNNKN
NK
K
NPPNKNPPN
NKNKNKNNKNKNKNNKNKNKNNKNKNKNKNNKNKNKNNKNKNKNNKNKNKNPN
PKPKPKPKPKPKPKPKPKPKPNKPKPKPKPKPKPKPKPKPKPKP
NNNNNNNNK
KKKN
PPPN
NNNNNNNNNNNNKN
NPKNPKNPP
PPPKNPPPKNPPPKNP
PPPPPNP
KKP
PKN
PPPPPN...

output:

86902

result:

ok 1 number(s): "86902"

Test #15:

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

input:

76
N
NKNKNNKNKNKN
KPKPKPKPKPKN
NK
KKKKKNK
NNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNKNNPNNPNNNPNNPNNKNNPNNPNNPNNKNNPNNPNNNPNNPNNK
NNPNNPNNPNNPNNPNNPNNPNNPNNK
KKKKKKKKKKPKKKKKKKKKKNP
KKPKKPK
PPPPPPPPPPPN
...

output:

12533

result:

ok 1 number(s): "12533"

Test #16:

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

input:

35
KPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKNKKP
P
KNKNKKNKNKNKKNKNKP
N
KKKKKKKKKKKKKKKKKKKKPKKKKKKKKKKKKKKKKKKKKKP
PNPNPNP
KPKPKPKPKPKPKPKPKNKKPKPKPKPKPKPKPKPKPKNK...

output:

1178

result:

ok 1 number(s): "1178"

Test #17:

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

input:

19
KPKPKPKPKKPKPKPKPKKPKPKPKPKKPKPKPKPKN
NPNPNNPNPNNP
NPNPNNPNPNNPNPNPNNPNPNNPNPNPNNPNPNNPNPNPNNPNPNNPNPNPNNPNPNNPNPNK
NPNPNNPNPNNPNPNPNNPNPNNPNPNPNNPNPNNPNPNPNNPNPNNPNPNPN
KPKNPKPKNPKPKKPKNPKPKNPKPKKPKNPKPKNPKPKKPKNPKPKNPKPKKPKNPKPKNPKPKKPKNP
NKKKPNKPKNKPPPNKPPNPNNNNPKPKPNKKNPNKKPNPNPKNKPPKKNNKPPKK...

output:

249

result:

ok 1 number(s): "249"

Test #18:

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

input:

32
NNKPNNNKPNNP
PNPPNPPNPPNPPNPK
PNP
NNPNNNPNNPNNNPNNPNNNPNNPN
P
NNPNNNPNNPNNNPNNPNNNPNNPNNNPNNK
NKNKNKNP
NNNNNNNNP
NPKNKNPKNKNPKNKNPKNKNPK
N
N
PPPPKP
N
KPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPKKPKPKPK...

output:

894

result:

ok 1 number(s): "894"

Test #19:

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

input:

300
PKK
KNP
PNPNPKPNPNPNPKPNPNPP
KNN
KPN
KNN
KKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNKKKNK
KKKN
...

output:

1120793

result:

ok 1 number(s): "1120793"

Test #20:

score: 0
Accepted
time: 9ms
memory: 15940kb

input:

45
PPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPPPPPPPPPKPP...

output:

2514

result:

ok 1 number(s): "2514"

Test #21:

score: 0
Accepted
time: 9ms
memory: 16304kb

input:

56
PNPPNPKNPNPPNPPNPKNPNPPNPPNPKN
NKN
PPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPKPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNPPPPPPPNPPPPPPPNPPPPPPNPPPPPPPNP...

output:

5856

result:

ok 1 number(s): "5856"

Test #22:

score: 0
Accepted
time: 9ms
memory: 16644kb

input:

55
K
PPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPPPNPKKPPPPPPPPPPPPPPPPKNPKNNPKPKPNPKKKKPKKPKKPPPP
PPNPPNPPPNPPNPPKPNPNPPNNNNK
KKKKKPPKKKKKPPKKKKKPPKKKKKNKKKKKPPKKKKKPPKKKKKPPKKKKKPPKKKKKNKKKKKPPKKKKKPPKKKKKPPKKKKKKKPPKKKK...

output:

5925

result:

ok 1 number(s): "5925"

Test #23:

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

input:

5000
PPK
PKN
NPK
KKN
PPN
NKK
NNP
KNK
KPP
NNP
NPP
KKN
NKK
KKK
PKN
NPP
PNK
NPK
KNP
PNP
KKN
NNK
PKK
PPP
KKN
NKP
KPK
KKK
PNK
PNK
NNK
KKP
KKK
NNK
PPP
PNP
PNP
KKN
NPN
PNK
NNK
PKK
PPN
KKP
PKK
NKP
KNP
PPK
NNK
PKP
PPN
KNP
PKK
NNN
KPP
KPN
KKN
PNP
NKK
KPP
NNN
NKP
NPK
NPP
PNN
NNK
KKP
PPP
NKP
KPN
KNN
PNN
NPP
KPP...

output:

5201172138

result:

ok 1 number(s): "5201172138"

Test #24:

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

input:

48
PPPNNPPKKNPKNNKKPKPKPPKNPPPKKPPNPNPKKPPPPPNPNPNPPPNPKPNPPPKKKNPKKPPPNPNNKKKKPKPPPPPPKPPNPKPNNPPPNPKKNPKNPPNKNNNNPNPNKNPKKKKNKNKKKPPNNKKKKNNPPNPNNNKNNPPKPPPKPKKKPPNNPNPKNKNPPPNNPPKKNPKNNKKPKPKPPKNPPPKKPPNPNPKKPPPPPNPNPNPPPNPKPNPPPKKKNPKKPPPNPNNKKKKPKPPPPPPKPPNPKPNNPPPNPKKNPKNPPNKNNNNPNPNKNPKKKKNKN...

output:

3732

result:

ok 1 number(s): "3732"

Test #25:

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

input:

31
PPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPPPPNPP...

output:

928

result:

ok 1 number(s): "928"

Test #26:

score: 0
Accepted
time: 9ms
memory: 15176kb

input:

67
KPNKKPNKKPNKKN
NP
KKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKKPKKKKKKKPKKKKKKK...

output:

10794

result:

ok 1 number(s): "10794"

Test #27:

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

input:

49
PNKPNKPNKPNKPNKPNNPNNNNNK
NPNNPNPNNPNPNNPNNPNPNNPNPNNPNPNNPNNPNPNNPNPNNPNNPNPNNPNPNNPNPNNPNNPNPNNPNPNNPNNP
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNKP
N
PPPKPPPPKPPPPKPPPPKPPPPKPPPPK
PNKPNKPNKPNKPNKPNNPNNNNNKPNKPNKPNKPNKPNKPNNPNNNNNKPNKPNKPNKPNKPNKPNNPNNNNNKPNKP...

output:

2554

result:

ok 1 number(s): "2554"

Test #28:

score: 0
Accepted
time: 9ms
memory: 14532kb

input:

34
NNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNNPNNPNNPNNPNNPNNPNNNPNNPNNPN...

output:

938

result:

ok 1 number(s): "938"

Test #29:

score: 0
Accepted
time: 9ms
memory: 15740kb

input:

55
PPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPN
NNNNNPNNNNNPNNNNNKNNNNNP
KPNKNPPKKNKNNKNPNKKPPNKKKKPPPPPNKKPNKPPKPPPPNPNNNNKKPNPKPKNKPKNKPPNPKKPKPPKPPKNKPPNKKPKKPPNPKKPPNPPNKKKNKPNKNPPKKNKNNKNPNKKPPNKKKKPPPPPNKKPNKPPKPPPPNPNNNNKKPNPKPKNKPKNKPPNPKKPKPPKPPKNKPPN...

output:

6093

result:

ok 1 number(s): "6093"

Test #30:

score: 0
Accepted
time: 9ms
memory: 14372kb

input:

19
NKNPNKNPNKNPNKNNKNPNKNPNKNPNKNNKNPNKNPNKNPNKNNKNP
PKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPKNPKPPKPPKKNKNPNPKPPKPPK...

output:

6

result:

ok 1 number(s): "6"

Test #31:

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

input:

13
NNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNKNNNK
KPKPKPKPKPKPKPKPKPKPKPKKKPKPKPKPKPKPKPKPKPKPKPKPKKKPKPKPKPKPKPKPKPKPKPKPKNNKPKPNPNNNNKKKKKKKNNNNPPPPKPK
NNKNNNKNNNKNNNKNNNKNNNKNN...

output:

4

result:

ok 1 number(s): "4"

Test #32:

score: 0
Accepted
time: 600ms
memory: 220364kb

input:

100000
KPKPNKPKKK
NKNPNKKPPP
NNKNPPNNKP
KPKPKPKNPN
NKPKKKKKPP
NKPNPKKPPP
NNKPNPKPNN
PPPKNNKNKN
KNNNNKKNKP
NNNKPKPKNN
PKPKNKPPPP
NKNPNPKPNP
KKPPPPKPKP
PNKKNKKKKK
PKKNNNKPKK
KKNPNPKKNK
NNKPKPPPPK
KPNKKPKKKK
PPNNKPKNKP
KPNNNPNNPN
NKKNKPNPPK
KKNNPNKPNP
KNNNPPPNNP
PNPNNNKKNK
NPKPNNPKKN
NNNPPPKKKP
PPPPNNN...

output:

41666533063326

result:

ok 1 number(s): "41666533063326"

Test #33:

score: 0
Accepted
time: 599ms
memory: 245192kb

input:

90910
PKNNKKKNNKN
PPKPNNKPKNN
KPKNPNPKKPN
NPNNNNPPKKP
PPPPNNKPNKP
PPKPNPPPPPP
NKPKKPNKNNK
KKNKPPPPPKP
PPPPPNNPKKP
PKNKKPPKKPP
PKKPNNPNPNP
PNPNKNPPPPN
KPNNPKKKKKN
NKNKPNPPPKK
NNKPPNNKPNK
KKPNNKPNNNP
KPNPKPKNPPN
PPKNNKNNNKP
KNNNNNNNPPK
NNPKPNKNNNN
KKNPPNPNKNP
NPPPPKNNPNK
PNNPPNKNKPN
KNNPNNNNNKN
KPNPPN...

output:

31305270429104

result:

ok 1 number(s): "31305270429104"

Test #34:

score: 0
Accepted
time: 618ms
memory: 220260kb

input:

100000
PKNPPNNNKK
NNNNKPKPNN
PKKKKNNNNK
KPNNKPNNPN
KNKKPKNNKK
KPNKKPNKNN
NNNNNKNNPN
KPKNKNKNNN
NPKPNPNNPN
PKNPKNKNPN
KPNNPNKNNN
NNPNNNKKNN
NKPPPPKPKP
KNNPKNKKNK
NPKPNPNKNK
PNPNKKPKNN
NNKKNNKNNK
NPPPNPPPPK
NPNNNKKPPK
KNNNKPPNPK
NNKPKNNPKK
NKKKNPNNKN
KKNPKPNNPP
KPPPNKKNNP
NNKKNKKNPK
NNKPPNPPPK
PPNKKKP...

output:

41666482937811

result:

ok 1 number(s): "41666482937811"

Test #35:

score: 0
Accepted
time: 590ms
memory: 245120kb

input:

90910
NPNPNKPPKPK
PNKPKKKPNPN
PPPKKKNPNNK
KKKPPNNNPKN
NKPPPNNKPKN
PNNNPNKNKKN
PKNKKKNNNPP
PKNKKPPKNPK
KNPNPNNPKPP
KNPNNPKNKPN
NNNNPKNPNNN
PKPKNKPNNKK
NPKKKKNPNPP
KNPPNPNPPKP
KKNNPKNPKPN
PKKNPKNPNNK
KKKPKPKPKKN
NKPPNPNKKPP
KNPNNPKKPPK
NPKKNNPNNNP
KKNPPPPPKKN
KKPNPPPKNKK
NPKKNKPNNPK
NNKPNKPKPKN
PNPPPN...

output:

31305518480160

result:

ok 1 number(s): "31305518480160"

Test #36:

score: 0
Accepted
time: 596ms
memory: 227192kb

input:

100000
KNPPNPPKPP
KNKNKPNPNK
PKKPKKPKPPK
NPKNNNKNN
KPNPNPPP
NNNPKKNKKN
PPNNNNKKPK
PKKNKPPN
NPNPNNKPKN
PKKPNPPKKK
NKNKKKPKKPP
NNKKNNPN
NNKNNNKP
PKNPPNPNKP
NNKNPNNKNP
NKNPKPKN
NPPPNPNPNK
NKKNKKPPK
NNNNPNPKKN
PKNNNPNK
PKNPKKNKNN
KNKKKPNPNN
PPKNPKPNPP
KNKKKNNPP
PPNNNNNPP
PPPPKPPNK
NNKKKPNPKP
PPNPNNPKKN
...

output:

41665507715198

result:

ok 1 number(s): "41665507715198"

Test #37:

score: 0
Accepted
time: 647ms
memory: 227672kb

input:

100000
KKNKNNKKP
NKKPPPNKKKP
KKPPPNPKPKN
NKNNKPKN
PNPKPNNPN
NKKKPKNNN
NPKKKNPKPK
NKNKNKPKNN
PNNNNNNPPN
PPKKPPKPNPP
KNKKNNKPPP
NNKNPNKNNP
KKPNKPKPPN
KPPNNKPKKPK
PNKPPKKNNP
KNPKNKKPKPN
NKPKNPKNKK
NPKPNNKPNN
PNKKNNNKNN
KPKKKKPNK
NKPKKKNNKK
KKPNKNPK
KPPKKKPPPP
KKKKKNNKNK
KKPPKPKNPK
KNPNPNPKKNP
NNNKNNKPK...

output:

41665397403242

result:

ok 1 number(s): "41665397403242"

Test #38:

score: 0
Accepted
time: 616ms
memory: 222792kb

input:

94029
KKNNPNPKP
NKPKNKNP
KKPKKKNPPK
KKKPNKN
NNKKPKPKKP
NNKPPKNPNNK
PNPKKNNKNP
KPNKNPPNNK
PKKKPNNK
NNNKPNPPNP
PPNNKKKNNK
PNPPNKKNNK
KPKKKKPKPN
PNKNKPPPKN
NNPKKPNKN
NPKPNPNP
NNPPPKPPPN
NNNNPKKKPN
NNNKNPKNPK
NPNPPNNNKP
PPPNNKNKNN
NNKNPNKPPK
NKKNNNKKNP
PNNPPKKPPK
KKPKNKPKNK
PNPPKKPKPK
KPKPNPPPKN
PPPPPPK...

output:

34639649098238

result:

ok 1 number(s): "34639649098238"

Test #39:

score: 0
Accepted
time: 585ms
memory: 215768kb

input:

89563
NKKNNPPNPP
NPNPNKNNPP
PNPKKKKKN
PNPPKNPPNN
NPPKKPKPKP
NNPKPKPNKN
PPNPPNPNNN
KNNNNNKNNK
KNNPNKNNNK
KPPPNPKPPP
NNKNPKNPK
KPPNPNPPPP
KKNPKNNPKP
NKPPKPKKK
PPPNNNPK
PKNPNNNNNK
KKKNPPKPKK
PKPPNPNNPP
PPPNPNKKP
PPKPKKKPKK
NPPPKNPNNK
PKNKNKNK
NNNKPKPN
PPNPNNNPKN
PNPNNPNK
NPNNPPPKPP
NKKPPPNN
PNNKKKPNP
P...

output:

29934660369186

result:

ok 1 number(s): "29934660369186"

Test #40:

score: 0
Accepted
time: 558ms
memory: 210308kb

input:

84434
PNNKNKNP
NKKNNKPNN
PPPNKNPPNK
NPPKPKKPP
KNNNNNPPP
NKKKNKPPN
NNPKPKPK
PPPKNPNKP
PPNKPKPKPN
NPKKPKKNKN
NNPKKKKNNN
NPKKNNNNKN
NKPKNPPPP
KNKPPNNPPN
KKNPNPNPN
PPPKKPPKKN
PNKKNKKKN
NNNNNPKKKK
KPPKNNNN
PPNKKPKKPP
KKPKKKKPPP
KKPNPPPKK
KNNNPKKPP
PNNPPPPPNP
PPNPNNNKP
PPPNKKKKPN
NPPKPKKKPK
NNPKNNKNPK
PNP...

output:

25080751336361

result:

ok 1 number(s): "25080751336361"

Test #41:

score: 0
Accepted
time: 643ms
memory: 229156kb

input:

100000
KNNKKNK
NNKPKKKKPN
PNPKKKKKNP
KKKKKPNKNK
PNNKPNPKNK
NKPKPNPKNN
KKPNPNKNNN
NNKKKNNKNK
KNKPNPPNNN
PNPPPPKPKK
PKPKKNP
NPPPNKPPN
PKNNPKNKNPN
NPNPPKKNKK
PPNNPPKPPNN
KKNNKNKNK
PPPPPNPNPKK
KPPNKKNKKP
PPNPNNKKKP
PKNPNPNNK
PNPPKNKNK
KNNNPPNNPN
NPKNNKPNP
KNNPNKNNKP
PNPPNNPPPN
KKKNKNNPKPK
NKKPPNPNNP
NNK...

output:

41666558834125

result:

ok 1 number(s): "41666558834125"

Test #42:

score: 0
Accepted
time: 678ms
memory: 228884kb

input:

100000
NPKPPPNKN
KPPNPNNPNP
KKPPPKNKPN
PKKNPKNNPP
NNNPPNKK
KKPPNKKNKN
PNNNNKNPK
PPKKKKPK
NKNKPKPP
KNPPKKKKKK
PPNKKNPPPKP
PPNPPPNPPK
KNNKNNNKKK
NKPPKNNPNK
KPNNNPNKPK
PPPNKPN
PNNPKNKPPK
NNNKNKKNNK
PKKNKNNNPP
NNKNKKPPKN
NKPKPPKPPN
NNNPKKPNKP
KPNNNNKKKP
PPKPNKNNNP
NPKPKKPNNPK
KNPKNNN
NNNNKKNNPK
NKPNKNKP...

output:

41666508623911

result:

ok 1 number(s): "41666508623911"

Test #43:

score: 0
Accepted
time: 95ms
memory: 128924kb

input:

1431
KPKKKPPPNPKKNKKKNPNNNNNPNKPPKPPNNKKPNKPKPPKNPNKKKPKNPPNKKKPNKNKNPPKNNPPNKKNPKNPNKNKNPNNNPNNPPNKNNKNNPPNPNPKNKNPNNKPPKNNKNNPPKPNKNNKPPPNPNNKNKPKKPPNPNNNNPKNNKPPKNKPPPNNNNPNNNPNNNPPKPKKPPNPPKNKNNKNNNNNKPPNKPPPNNPPKNKKPPPPNKNPNPKPKPPPKKPNKNPPNPKKNNNPNPPKPPNPPKNNKPPPPPNPNPPNKNPKPPKKKKPNKPNNKPKKKNKP...

output:

181046

result:

ok 1 number(s): "181046"

Test #44:

score: 0
Accepted
time: 97ms
memory: 131272kb

input:

2422
KKPNKNPPNNPPPKKPKPKKPNPKNNKKNNKPPPNKPNKPNNNKKPKNNKPPKKKPNPNKPPNPPNKKPKKPPNNKPKNNPPPKNPKPPKKNKNPPKNNPKNKKKPNKPKPKNKKPPKNPPNPNKNNNNPKKPPPNNPNPNKNPNKNKNNPKPNPPNKPKKKPNNKNPPKNNPKKKKKPNPNKKKPPKN
KKPNKNPPNNPPPKKPKPKKPNPKNNKKNNKPPPNKPNKPNNNKKPKNNKPPKKKPNPNKPPNPPNKKPKKPPNNKPKNNPPPKNPKPPKKNKNPPKNNPKNKKK...

output:

197656557

result:

ok 1 number(s): "197656557"

Test #45:

score: 0
Accepted
time: 94ms
memory: 128576kb

input:

1425
KKKPNPKNNKNNPPPNPKNNPPPKPKNKPKKNNPKKKNKPKNNPKNKKPKNNNPNKKKKPPPNPKKKNPKNPPPNNKPPPPPNNNKNNKNNPPKKNNKKPKNKNKPKNKNPPNNKPNKKPNKKKPNPNPNKPKPNPNPNNPNKKNNPKPNNNKKNKPNKKPPKKPPPPKPPKKPKNPPNKKPPKPNNNKPKKPPPKN
KKKPNPKNNKNNPPPNPKNNPPPKPKNKPKKNNPKKKNKPKNNPKNKKPKNNNPNKKKKPPPNPKKKNPKNPPPNNKPPPPPNNNKNNKNNPPKKNN...

output:

86912

result:

ok 1 number(s): "86912"

Test #46:

score: 0
Accepted
time: 97ms
memory: 130316kb

input:

1435
PPPPNKNNKPNPKNKPKNPKNPKNNPNNKPPPNKKPPPKNPKNPPKPNPKKPNPPKPPPKKKPNNPKPNPNNNKKNKPKPKKNKNKKPPNPPPNNKNKNPPKPPNPNNPKPKPKNNKPNNPKNPNNPNNKNPPNPPPKNNPNKPNPKNKKPNNKKKPKNPPKPPKPKPNNPPKKKNKNKPKKNNNKKNPKNNPPNKKNKPNNKKNPKPKPNPKKNPNNNPNPNPKPKKKNNNPNKKKNKNNPNNNNNPPKNPKNKNPNPKPPKNKNKNPNPNNPPNNKPPKNKNPKKKNNKPNNN...

output:

49002

result:

ok 1 number(s): "49002"

Test #47:

score: 0
Accepted
time: 97ms
memory: 130572kb

input:

1431
NNNNNPKKKKKNPNNNKNNNPPNNKNNNNPPKKKNNNKKNKPPKNPNPPPNPNKKKNKNPPKPNNKPNPKKNPKPNKKNKNKKKKNNPNNNNNNNKNNNKNPKNNKPPKNNPPPNKKKNNNPKNNNNPKNPNKPNPKKPPPPPPPKKPNPKPPPNNNKKNKNKKPNNPNKPNNNKNNKKNPPKNKNNPPKKKKPPNPKNNKPPPNPKPNPNPPNPNPKPNNPPNNPPPKPKKPNPKPKKNNPNKNPKPPNNPKKKKKPPPPKKKPKKNKPNKKNKPPPKPKNPPPPKKKNPNKNN...

output:

33534

result:

ok 1 number(s): "33534"

Test #48:

score: 0
Accepted
time: 97ms
memory: 130124kb

input:

1425
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

22675

result:

ok 1 number(s): "22675"

Test #49:

score: 0
Accepted
time: 90ms
memory: 129356kb

input:

1408
KNKPKNKPKNKPKNKPKNKNKPKNKPKNKPKNKPKNKNKPKNKPKNKPKNKPKNKNKPKNKPKNKPKNKPKNKNKPKNKPKNKPKNKPKNKKNKPKNKPKNKPKNKPKN
NPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPNPN...

output:

25747145

result:

ok 1 number(s): "25747145"

Test #50:

score: 0
Accepted
time: 96ms
memory: 129868kb

input:

1260
NKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPNKPN...

output:

23649523

result:

ok 1 number(s): "23649523"

Test #51:

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

input:

1434
KPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPKNKPK...

output:

396472

result:

ok 1 number(s): "396472"

Test #52:

score: 0
Accepted
time: 86ms
memory: 126860kb

input:

831
KKKKPKKKKNKK
KKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPKKKKNKKKKPK
NNNNPN...

output:

2888770

result:

ok 1 number(s): "2888770"

Test #53:

score: 0
Accepted
time: 94ms
memory: 127576kb

input:

437
NNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNN
NNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNNNNPNNNNNKNNN...

output:

631708

result:

ok 1 number(s): "631708"

Test #54:

score: 0
Accepted
time: 99ms
memory: 130612kb

input:

1999
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNK
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...

output:

998001

result:

ok 1 number(s): "998001"

Test #55:

score: 0
Accepted
time: 107ms
memory: 130636kb

input:

1992
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

984176

result:

ok 1 number(s): "984176"

Test #56:

score: 0
Accepted
time: 92ms
memory: 128708kb

input:

1271
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...

output:

9491574

result:

ok 1 number(s): "9491574"

Test #57:

score: 0
Accepted
time: 92ms
memory: 128716kb

input:

634
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...

output:

19596

result:

ok 1 number(s): "19596"

Test #58:

score: 0
Accepted
time: 94ms
memory: 128456kb

input:

1047
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKPKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

23615208

result:

ok 1 number(s): "23615208"

Test #59:

score: 0
Accepted
time: 111ms
memory: 130244kb

input:

1527
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

130305002

result:

ok 1 number(s): "130305002"

Test #60:

score: 0
Accepted
time: 92ms
memory: 129736kb

input:

1580
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

140682297

result:

ok 1 number(s): "140682297"

Test #61:

score: 0
Accepted
time: 88ms
memory: 129096kb

input:

1178
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
KKKKKKKKKK...

output:

14629380

result:

ok 1 number(s): "14629380"

Test #62:

score: 0
Accepted
time: 97ms
memory: 128028kb

input:

1112
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

45144441

result:

ok 1 number(s): "45144441"

Test #63:

score: 0
Accepted
time: 92ms
memory: 129100kb

input:

872
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

11983964

result:

ok 1 number(s): "11983964"

Test #64:

score: 0
Accepted
time: 98ms
memory: 129096kb

input:

1424
KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK...

output:

49423

result:

ok 1 number(s): "49423"

Test #65:

score: 0
Accepted
time: 99ms
memory: 129868kb

input:

1419
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

144860

result:

ok 1 number(s): "144860"

Test #66:

score: 0
Accepted
time: 90ms
memory: 128840kb

input:

533
NK
KPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKNKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKNKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKNKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKNKPKKPKPKKPKKPKPKKPKPKKPKKPKPKKPKKPK...

output:

6132079

result:

ok 1 number(s): "6132079"

Test #67:

score: 0
Accepted
time: 88ms
memory: 127816kb

input:

410
NKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNNKNPNKNNKNNKNNKNNKNKNNKNNKN...

output:

2806630

result:

ok 1 number(s): "2806630"

Test #68:

score: 0
Accepted
time: 91ms
memory: 129028kb

input:

49
P
PNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNPKPNPPNP...

output:

3347

result:

ok 1 number(s): "3347"

Test #69:

score: 0
Accepted
time: 91ms
memory: 127380kb

input:

279
PPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPKPPPNPPPNPPPKPPPNPPPNPPPNPPPK
NPNPNPNKNPNPNPNNNPNPNPNKNPNPNPNKNPNPNPNNNPNPNPNKNPNPNPNKNPNPNPNNNPNPNPNKNPNPNPNKNPNPNPNNNPNPNPNKNPNPNPNKNPNPNPNNNPN...

output:

883089

result:

ok 1 number(s): "883089"

Test #70:

score: 0
Accepted
time: 89ms
memory: 128328kb

input:

251
NNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNPNNNNPNNPNNPNNNNPNNPNNPNNKNNPNNPNNPNNNNPNNPNNPNNNNP
PPNPPNPPPNPPNPPPNPPNPPNPPPNPPNPPPNPPNPPNPPPNPPNPPPNPPNPPNPPPNPPNPPPNPPNPPNPPPNPPNPPPNP...

output:

628736

result:

ok 1 number(s): "628736"

Test #71:

score: 0
Accepted
time: 90ms
memory: 128204kb

input:

1054
KKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNKKPPKKKPPKKPPKKKPPKKNK...

output:

47129682

result:

ok 1 number(s): "47129682"

Test #72:

score: 0
Accepted
time: 89ms
memory: 127280kb

input:

70
PPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPPNPPPPPKKPPPPPPKKPPPPPPKKPPPPP...

output:

11246

result:

ok 1 number(s): "11246"

Test #73:

score: 0
Accepted
time: 89ms
memory: 127556kb

input:

88
PPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPP...

output:

21642

result:

ok 1 number(s): "21642"

Test #74:

score: 0
Accepted
time: 88ms
memory: 127308kb

input:

120
NPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNPNPNPNPNKNP...

output:

69079

result:

ok 1 number(s): "69079"

Test #75:

score: 0
Accepted
time: 92ms
memory: 127668kb

input:

300
PKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPNNPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPNNPKPKPKPKPKPKPKPKPKPPKPKPKPKPKPKPKPKPKPKPPKPKPKPK...

output:

1081808

result:

ok 1 number(s): "1081808"

Test #76:

score: 0
Accepted
time: 86ms
memory: 128544kb

input:

160
KKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKPKKNKKKNKKKNKKKNKKKNKKKNKKNKK...

output:

155663

result:

ok 1 number(s): "155663"

Test #77:

score: 0
Accepted
time: 86ms
memory: 126764kb

input:

34
PKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKNPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKPKPKPKPKPKPKPKKPKP...

output:

1091

result:

ok 1 number(s): "1091"

Test #78:

score: 0
Accepted
time: 87ms
memory: 126864kb

input:

145
NNNNNNNNNKNNNNNNNNNKNNNNNNNNNNNKNNNNNNNNNKNNNNNNNNNNNKNNNNNNNNNKNNNNNNNNNNNKNNNNNNNNNKNNNNNNNNNNNKNNNNNNNNNKNNNNNNNNNNNKNNNNNNNNNKNNNNNNNNNPKPNPNPKNNKPPKKPKKKNPKPNKPKKNNPPPNKNNNNNNNNNKNNNNNNNNNKNN
PPNPPKPPNPPNPPKPPNPPPPNPPKPPNPPNPPKPPNPPNPPKPPNPPPPNPPKPPNPPNPPKPPNPPPPNPPKPPN
PPPPPPPPPPPPPKPPPPPP...

output:

119566

result:

ok 1 number(s): "119566"

Test #79:

score: 0
Accepted
time: 91ms
memory: 126924kb

input:

164
PNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPKPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPKPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPKPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPKPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPPNPNPPNPPNPK...

output:

172563

result:

ok 1 number(s): "172563"

Test #80:

score: 0
Accepted
time: 89ms
memory: 127240kb

input:

40
PPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPPKPPPPNPPPPKPPPPPKPPPPPKPPPPPKPPPPPK...

output:

1435

result:

ok 1 number(s): "1435"

Test #81:

score: 0
Accepted
time: 92ms
memory: 128072kb

input:

204
NPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNKNPNPNPNPNPNPNPNK
PKPKPNPKPKPNPKPKPKPNPKPKPNPKPKPKPNPKPKPNPKPKPKPNPKPKPNPKPKPPKPKPNPKPKPNPKPKPKPNPKPKPNPKPKPKPNP...

output:

346007

result:

ok 1 number(s): "346007"

Test #82:

score: 0
Accepted
time: 87ms
memory: 127332kb

input:

104
N
PKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPPKPKPKPKP
KNKNKPPKNKNKNKPPKNKNKKNKNKPPKNKNKNKPPKNKNKNKPPKNKNKKNKNKPPKNKNKNKPPKNKNKNKPPKNKNKKNKNKPPKNKNKNKPPKNKN...

output:

42725

result:

ok 1 number(s): "42725"

Test #83:

score: 0
Accepted
time: 88ms
memory: 126920kb

input:

148
KNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPKKNPKPKNPKPKNPKNPKPKNPKPKNPKKNPKPKNPKPKNPKPKNPK...

output:

126056

result:

ok 1 number(s): "126056"

Test #84:

score: 0
Accepted
time: 93ms
memory: 126656kb

input:

172
PKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKPKPKPKPNNPKPKPKPKPKPKPPKPKPKPKPKPKPPKPKPKP...

output:

201612

result:

ok 1 number(s): "201612"

Test #85:

score: 0
Accepted
time: 90ms
memory: 128384kb

input:

179
KNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNPKNPKNPKNPKNPKNKNPKNPKNP...

output:

212694

result:

ok 1 number(s): "212694"

Test #86:

score: 0
Accepted
time: 302ms
memory: 268276kb

input:

100000
KP
PP
NN
KK
PN
KK
PK
KK
KK
PN
PP
NK
KN
PN
NK
KN
PN
PP
PP
NK
KK
PP
PK
PN
KP
PN
NK
PN
KP
PP
PK
KN
KN
NN
PN
PP
NP
NK
KP
KK
NP
KP
NK
NK
KN
PP
KN
NK
KP
KK
KP
PP
PN
KP
PK
PN
NK
KP
NN
NK
PP
NK
NK
KN
KP
KN
PK
KN
NN
PN
PK
KK
NP
KK
PN
PN
NN
KN
PN
KK
KK
KN
NN
NN
NN
NK
NN
PP
NK
PK
KK
PK
PK
KP
KK
PK
PN
NN...

output:

41152254796493

result:

ok 1 number(s): "41152254796493"

Test #87:

score: 0
Accepted
time: 86ms
memory: 127952kb

input:

38
KKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKPKKPKKPKKPKKPKKPKKPKKKPKKP...

output:

2175

result:

ok 1 number(s): "2175"

Test #88:

score: 0
Accepted
time: 84ms
memory: 127936kb

input:

105
KPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKPKNKPKPKKPKPKNKPKPKKPKPKNKPKPKNKPKPKKPKPKNKPKPKK...

output:

41507

result:

ok 1 number(s): "41507"

Test #89:

score: 0
Accepted
time: 93ms
memory: 128124kb

input:

122
KPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKNKKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKNKKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKNKKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKNKKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKPKKPKKPKPKKPKKPKNKKPKKPKKPKPKKPKKPKKPKPKKPKKPKPKKP...

output:

70136

result:

ok 1 number(s): "70136"

Test #90:

score: 0
Accepted
time: 90ms
memory: 128572kb

input:

19
KPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKNKPKKKPKKKPKKKPKKKPKKKPKKKPKKKPKKK...

output:

87

result:

ok 1 number(s): "87"

Test #91:

score: 0
Accepted
time: 86ms
memory: 128212kb

input:

42
NPNNPNPNNPNNPNPNNPNNPNPNNPNKKNPNNPNPNNPNNPNPNNPNNPNPNNPNKKNPNNPNPNNPNNPNPNNPNNPNPNNPNNPNPNNPNKK
NKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKNNKNKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKNNKNKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKNNKNKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKNNKNKNKNKNKNKNNKNKNKNKNKNPNKNKNKNKNKN...

output:

1601

result:

ok 1 number(s): "1601"

Test #92:

score: 0
Accepted
time: 86ms
memory: 126464kb

input:

24
P
PPPPPPPPPPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPPPPPPPPPPPKPPPPPPPPPPPPPPPPPPPPPPPPPPNNPPPPPPPPPPPPPPPPPPPPPPPPPPKP
P
K
KKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKKNKKKKKKKKKKKKKKKKNK...

output:

452

result:

ok 1 number(s): "452"

Test #93:

score: 0
Accepted
time: 87ms
memory: 127300kb

input:

3
KPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKNKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPKKPK...

output:

1

result:

ok 1 number(s): "1"

Test #94:

score: 0
Accepted
time: 92ms
memory: 127556kb

input:

3
NKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPNKPNKPNKKNKPNKPNKPNKKNKPNKPNKKNKPN...

output:

1

result:

ok 1 number(s): "1"

Test #95:

score: 0
Accepted
time: 83ms
memory: 127720kb

input:

3
PKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKPPKPNKPKPNKPKPNKPKP...

output:

1

result:

ok 1 number(s): "1"

Test #96:

score: 0
Accepted
time: 88ms
memory: 128776kb

input:

3
KNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKNKNKKNKNKKNKNKKNKNKPNKN...

output:

1

result:

ok 1 number(s): "1"

Test #97:

score: 0
Accepted
time: 86ms
memory: 126824kb

input:

3
KKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNKKKKKPPKKKKKNKKKKKKNKKKKKKNK...

output:

1

result:

ok 1 number(s): "1"

Test #98:

score: 0
Accepted
time: 82ms
memory: 128936kb

input:

3
NNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKKNNNKKNNNKKNNNKKNNNNKKNNNKK...

output:

1

result:

ok 1 number(s): "1"

Test #99:

score: 0
Accepted
time: 86ms
memory: 128560kb

input:

3
NKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKNKNNKNKNKNKNKNKNKNKNKNKNKNKNKN...

output:

1

result:

ok 1 number(s): "1"

Test #100:

score: 0
Accepted
time: 88ms
memory: 129076kb

input:

3
PPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPPPKPPPNNPPPNNPPPNNPP...

output:

1

result:

ok 1 number(s): "1"

Test #101:

score: 0
Accepted
time: 86ms
memory: 127184kb

input:

3
PPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPKPPPKPPKPPPKPPKPPPK...

output:

1

result:

ok 1 number(s): "1"

Test #102:

score: 0
Accepted
time: 86ms
memory: 128332kb

input:

3
KNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNNPNKNNPNKNNPNKNNPNKNNPNKNNPPKNN...

output:

1

result:

ok 1 number(s): "1"

Test #103:

score: 0
Accepted
time: 83ms
memory: 126752kb

input:

3
KKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKKKKNKKKNKKKNKK...

output:

1

result:

ok 1 number(s): "1"

Test #104:

score: 0
Accepted
time: 213ms
memory: 276536kb

input:

96791
P
K
K
K
P
P
P
N
N
N
N
K
K
P
K
N
N
P
N
P
K
N
K
K
N
P
N
N
N
N
P
P
P
P
K
N
P
P
N
N
N
K
K
K
P
K
K
K
P
P
P
N
N
K
K
K
N
K
P
N
K
N
P
P
N
N
N
N
N
N
N
P
N
K
P
N
P
P
K
K
K
P
K
P
P
P
P
N
K
K
N
K
P
P
N
P
N
K
K
N
N
K
K
P
N
N
N
P
N
N
K
P
N
N
N
N
N
K
K
N
N
P
P
N
P
N
P
K
P
P
K
N
N
K
P
K
K
P
K
P
N
K
P
N
P
P
K
...

output:

33584676217785

result:

ok 1 number(s): "33584676217785"

Test #105:

score: 0
Accepted
time: 86ms
memory: 128208kb

input:

3
N
P
PPNNKPPNNNNNKKNPPNPKNPKPNNPKPPPNPKNPPKKKNPKKPNPPNNKKPKKNKNPNKKPPNNKPPNNNNNKKNPPNPKNPKPNNPKPPPNPKNPPKKKNPKKPNPPNNKKPKKNKNPNKKPPNNKPPNNNNNKKNPPNPKNPKPNNPKPPPNPKNPPKKKNPKKPNPPNNKKPKKNKNPNKKPPNNKPPNNNNNKKNPPNPKNPKPNNPKPPPNPKNPPKKKNPKKPNPPNNKKPKKNKNPNKKPPNNKPPNNNNNKKNPPNPKNPKPNNPKPPPNPKNPPKKKNPKKPN...

output:

0

result:

ok 1 number(s): "0"

Test #106:

score: 0
Accepted
time: 85ms
memory: 128724kb

input:

3
P
K
KPKKNNKKNPPNKPKPPNKKKKNKPKKKPPKKKPPKPPKKKNKNPKPKPNKKKNNKNNKNPPKKPNKPKPPNKPPKKPKKPNKNNNNNPPNNPPPNKPKPPPPNPKNNKNKPPPKNPPKKNNKPNNPNPNKNPPKPNKKNPNPNKPKPNKNNPNPKPKPNNNPNKPKPKKNPNPKKNNNNNNNPNNPPKPKKPNPNKPNPKKPPPPNNPKPPKPKPKNPNNPKNNPPKNKKNNPNPPKKNKPKPNKKNKKNPPKKPKKKPPPNNPPKKKKNNKPPKKNPNKKNPPKKPPNPKNN...

output:

0

result:

ok 1 number(s): "0"

Test #107:

score: 0
Accepted
time: 176ms
memory: 158920kb

input:

30000
K
KK
KN
KP
KKK
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKK
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKN
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPKP
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKK
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPK...

output:

234473921331

result:

ok 1 number(s): "234473921331"

Test #108:

score: 0
Accepted
time: 161ms
memory: 152948kb

input:

25000
K
KK
KN
KP
KKK
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKK
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKN
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPKP
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKK
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPK...

output:

148393620566

result:

ok 1 number(s): "148393620566"

Test #109:

score: 0
Accepted
time: 137ms
memory: 148764kb

input:

20000
K
KK
KN
KP
KKK
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKK
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKN
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPKP
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKK
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPK...

output:

83359010332

result:

ok 1 number(s): "83359010332"

Test #110:

score: 0
Accepted
time: 178ms
memory: 159712kb

input:

30000
K
KN
KP
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPKK
KKPKN
KKPKP
KKPNK
KKPNN
KK...

output:

234181102846

result:

ok 1 number(s): "234181102846"

Test #111:

score: 0
Accepted
time: 159ms
memory: 154456kb

input:

25000
K
KN
KP
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPKK
KKPKN
KKPKP
KKPNK
KKPNN
KK...

output:

147951865179

result:

ok 1 number(s): "147951865179"

Test #112:

score: 0
Accepted
time: 138ms
memory: 149612kb

input:

20000
K
KN
KP
KKN
KKP
KNK
KNN
KNP
KPK
KPN
KPP
KKKN
KKKP
KKNK
KKNN
KKNP
KKPK
KKPN
KKPP
KNKK
KNKP
KNNK
KNNN
KNNP
KNPK
KNPN
KNPP
KPKK
KPKN
KPNK
KPNN
KPNP
KPPK
KPPN
KPPP
KKKKN
KKKKP
KKKNK
KKKNN
KKKNP
KKKPK
KKKPN
KKKPP
KKNKK
KKNKN
KKNKP
KKNNK
KKNNN
KKNNP
KKNPK
KKNPN
KKNPP
KKPKK
KKPKN
KKPKP
KKPNK
KKPNN
KK...

output:

83312415330

result:

ok 1 number(s): "83312415330"

Test #113:

score: 0
Accepted
time: 216ms
memory: 279860kb

input:

100000
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K...

output:

2499950000

result:

ok 1 number(s): "2499950000"

Test #114:

score: 0
Accepted
time: 212ms
memory: 279916kb

input:

100000
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K
K...

output:

0

result:

ok 1 number(s): "0"

Test #115:

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

input:

3
P
K
N

output:

1

result:

ok 1 number(s): "1"

Test #116:

score: 0
Accepted
time: 90ms
memory: 128752kb

input:

3
P
K
NKPPNKKPPPNPKNNPNKNKPPNNKPNPPPPKKKNPKKKNPKKKNNPPPKPPKKPPKNNKNKNKNPNKPPPNKPPKPKKPKPNPPPKKNKNNPPNKPKPPKNPNKNKNPPPKNNPKPNPKNKKKNNNNKPNKKPNNNKPNNNKNPKPPPNPNNPPNPNKNKPKNKNNKKKNNPNPPKPPNNNPNKPPPKPPNNNNPKPKKNPNKPPKPKPKPNPKPNPPNPPPNPNKNPNPNKKKKNPKPPPKPPPKKKPNPKKPNKPPPPNPPKNKKNKPNNNKKKNNNNKPKPKNKPKNPPN...

output:

1

result:

ok 1 number(s): "1"

Extra Test:

score: 0
Extra Test Passed