結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2018-09-19 17:04:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 842 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-07-18 08:17:18 |
合計ジャッジ時間 | 1,440 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
class No154: n = 0 que_list = [] def __init__(self): self.n = int(input()) for i in range(self.n): self.que_list.append(input()) def solve(self): ans_list = [] for t in self.que_list: # type: str ans_list.append(self.check_str(t)) return ans_list @staticmethod def check_str(t): if not t.count("G") == t.count("R"): return "impossible" g_cnt = 0 r_cnt = 0 for c in t: if c == "G": g_cnt += 1 elif c == "R": r_cnt += 1 if g_cnt < r_cnt: return "impossible" return "possible" if __name__ == "__main__": que = No154() ans = que.solve() for s in ans: print(s)