結果
| 問題 |
No.154 市バス
|
| ユーザー |
mnr
|
| 提出日時 | 2020-03-02 22:00:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 800 bytes |
| コンパイル時間 | 128 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 18,688 KB |
| 最終ジャッジ日時 | 2024-10-13 21:18:48 |
| 合計ジャッジ時間 | 3,190 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
def judge(list):
cnt_r = 0
cnt_g = 0
cnt_w = 0
pori = True
for i in range(1,len(list)+1):
if list[-i] == 'R':
cnt_r += 1
elif list[-i] == 'G':
cnt_g += 1
elif list[-i] == 'W':
cnt_w += 1
if cnt_g > cnt_r:
pori = False
break
elif cnt_g == 0 and cnt_w > 0:
pori = False
break
elif cnt_r == 0 and cnt_w > 0:
pori = False
break
if cnt_g != cnt_r:
pori = False
if pori == True:
print("possible")
if pori == False:
print("impossible")
T = int(input())
L = []
for i in range(T):
S = input()
L.append(list(S))
for i in range(T):
judge(L[i])
mnr