結果

問題 No.154 市バス
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-06-06 19:29:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 7,960 KB
最終ジャッジ日時 2023-09-12 22:47:45
合計ジャッジ時間 2,514 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
7,780 KB
testcase_01 AC 200 ms
7,812 KB
testcase_02 AC 196 ms
7,920 KB
testcase_03 WA -
testcase_04 AC 195 ms
7,776 KB
testcase_05 AC 15 ms
7,960 KB
testcase_06 AC 16 ms
7,772 KB
testcase_07 AC 216 ms
7,948 KB
testcase_08 AC 16 ms
7,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    w = g = 0
    b = False
    for c in input():
        if c == 'W':
            w += 1
            b = False
        elif c == 'G':
            if w == 0:
                b = False
                break
            w -= 1
            g += 1
            b = True
        elif g != 0:
            g -= 1
    if g==0 and b:
        print('possible')
    else:
        print('impossible')
0