結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー |
![]() |
提出日時 | 2024-04-12 22:38:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 82,116 KB |
実行使用メモリ | 99,644 KB |
最終ジャッジ日時 | 2024-10-02 23:33:23 |
合計ジャッジ時間 | 2,869 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
from collections import defaultdict, deque, Counter from functools import cache # import copy from itertools import combinations, permutations, product, accumulate, groupby, chain from heapq import heapify, heappop, heappush import math import bisect from pprint import pprint from random import randint, shuffle import sys # sys.setrecursionlimit(200000) input = lambda: sys.stdin.readline().rstrip('\n') inf = float('inf') mod1 = 10**9+7 mod2 = 998244353 def ceil_div(x, y): return -(-x//y) ################################################# T = int(input()) for _ in range(T): N = int(input()) S = list(input().split("-")) x = 0 for s in S: if s == "" or s[0] != s[-1]: continue x += 1 if s[0] == "K" else -1 print("K" if x >= 0 else "P")