結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー | MasKoaTS |
提出日時 | 2024-01-02 20:42:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 195 ms / 2,000 ms |
コード長 | 1,167 bytes |
コンパイル時間 | 136 ms |
コンパイル使用メモリ | 82,028 KB |
実行使用メモリ | 104,328 KB |
最終ジャッジ日時 | 2024-09-27 17:53:06 |
合計ジャッジ時間 | 3,188 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
86,404 KB |
testcase_01 | AC | 139 ms
89,548 KB |
testcase_02 | AC | 156 ms
89,284 KB |
testcase_03 | AC | 180 ms
90,240 KB |
testcase_04 | AC | 195 ms
90,740 KB |
testcase_05 | AC | 145 ms
104,328 KB |
testcase_06 | AC | 121 ms
89,940 KB |
testcase_07 | AC | 138 ms
91,272 KB |
testcase_08 | AC | 135 ms
91,396 KB |
testcase_09 | AC | 147 ms
89,536 KB |
testcase_10 | AC | 140 ms
89,160 KB |
testcase_11 | AC | 134 ms
89,268 KB |
testcase_12 | AC | 140 ms
89,976 KB |
testcase_13 | AC | 138 ms
92,600 KB |
ソースコード
import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp()[:-1] getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda : list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] getEdges = lambda n : [[x - 1 for x in getNs()] for _ in [0] * n] getWEdges = lambda n : [[x - (i < 2) for i, x in enumerate(getNs())] for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dxs = [1, 0, -1, 0]; dys = [0, 1, 0, -1] #di = coll.defaultdict(int) """ Main Code """ for _ in [0] * getN(): n = getN() s = input() g = 0 for ss in s.split('-'): if not(ss): continue g += (ss[0] == 'K' and ss[-1] == 'K') - (ss[0] == 'P' and ss[-1] == 'P') if(g >= 0): print('K') else: print('P')