結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:06:02 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 76,680 KB |
最終ジャッジ日時 | 2025-06-12 16:06:06 |
合計ジャッジ時間 | 1,413 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 2 MLE * 6 |
ソースコード
T = int(input()) for _ in range(T): S = input().strip() count_g = S.count('G') count_r = S.count('R') count_w = S.count('W') if count_g != count_r: print("impossible") continue if count_w < count_g: print("impossible") continue current_g = 0 current_r = 0 w_so_far = 0 possible = True for c in S: if c == 'W': w_so_far += 1 elif c == 'G': current_g += 1 if w_so_far < current_g: possible = False break elif c == 'R': current_r += 1 if current_r > current_g: possible = False break print("possible" if possible else "impossible")