結果

問題 No.2723 Fortune-telling by Flowers
ユーザー 👑 p-adicp-adic
提出日時 2023-12-25 15:30:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 959 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 11,004 KB
最終ジャッジ日時 2023-12-25 15:30:37
合計ジャッジ時間 4,921 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 62 ms
10,112 KB
testcase_02 AC 255 ms
10,112 KB
testcase_03 AC 823 ms
10,112 KB
testcase_04 AC 959 ms
10,112 KB
testcase_05 AC 102 ms
11,004 KB
testcase_06 AC 185 ms
10,880 KB
testcase_07 AC 209 ms
11,004 KB
testcase_08 AC 202 ms
11,004 KB
testcase_09 AC 266 ms
10,112 KB
testcase_10 AC 204 ms
10,112 KB
testcase_11 AC 199 ms
10,112 KB
testcase_12 AC 199 ms
10,240 KB
testcase_13 AC 206 ms
10,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
for t in R(int(I())):
	N,S,c=int(I()),I()+'-','-'
	K=P=0
	for i in R(N):
		if S[i]>'-':
			if c<'K':c=S[i]
			if S[i+1]<'K':
				if c==S[i]:
					if c>'K':P+=1
					else:K+=1
				c='-'
	print("KP"[P>K])
0