結果

問題 No.154 市バス
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-06-06 19:39:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 7,952 KB
最終ジャッジ日時 2023-09-12 22:47:42
合計ジャッジ時間 2,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
7,724 KB
testcase_01 AC 205 ms
7,896 KB
testcase_02 AC 200 ms
7,804 KB
testcase_03 AC 156 ms
7,952 KB
testcase_04 AC 194 ms
7,948 KB
testcase_05 AC 15 ms
7,764 KB
testcase_06 AC 15 ms
7,892 KB
testcase_07 AC 216 ms
7,872 KB
testcase_08 AC 15 ms
7,892 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':
            w -= 1
            g += 1
            if w < 0:
                break
            b = True
        else:
            g -= 1
            if g < 0:
                break
                
    if g==0 and b:
        print('possible')
    else:
        print('impossible')
0