結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー | hato336 |
提出日時 | 2024-04-12 21:54:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 234 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,552 KB |
実行使用メモリ | 147,468 KB |
最終ジャッジ日時 | 2024-04-12 21:55:08 |
合計ジャッジ時間 | 3,059 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,216 KB |
testcase_01 | AC | 72 ms
75,972 KB |
testcase_02 | AC | 106 ms
76,556 KB |
testcase_03 | AC | 133 ms
77,356 KB |
testcase_04 | AC | 229 ms
77,500 KB |
testcase_05 | AC | 83 ms
97,296 KB |
testcase_06 | AC | 144 ms
119,928 KB |
testcase_07 | AC | 188 ms
147,468 KB |
testcase_08 | AC | 187 ms
147,460 KB |
testcase_09 | AC | 102 ms
76,136 KB |
testcase_10 | AC | 103 ms
76,640 KB |
testcase_11 | AC | 97 ms
78,704 KB |
testcase_12 | AC | 154 ms
120,000 KB |
testcase_13 | AC | 234 ms
145,304 KB |
ソースコード
import sys input = sys.stdin.readline for i in range(int(input())): n = int(input()) s = list(input().rstrip()) def rle(s): res = [] for j in s: if not res or res[-1][0] != j: res.append([j,1]) else: res[-1][1] += 1 return res p,k = 0,0 x = rle(s) for j,z in x: if j == 'P': p += 1 if j == 'K': k += 1 if p > k: print('P') else: print('K')