結果

問題 No.2723 Fortune-telling by Flowers
ユーザー 👑 p-adicp-adic
提出日時 2023-12-25 15:30:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 361 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,680 KB
最終ジャッジ日時 2023-12-25 15:30:49
合計ジャッジ時間 3,375 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 94 ms
76,208 KB
testcase_02 AC 135 ms
76,600 KB
testcase_03 AC 361 ms
77,680 KB
testcase_04 AC 340 ms
76,616 KB
testcase_05 AC 55 ms
76,600 KB
testcase_06 AC 63 ms
76,456 KB
testcase_07 AC 72 ms
76,756 KB
testcase_08 AC 71 ms
76,628 KB
testcase_09 AC 333 ms
77,632 KB
testcase_10 AC 108 ms
76,836 KB
testcase_11 AC 229 ms
75,224 KB
testcase_12 AC 81 ms
75,368 KB
testcase_13 AC 83 ms
76,576 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