結果

問題 No.154 市バス
ユーザー 6soukiti29
提出日時 2017-09-18 18:53:45
言語 Nim
(2.2.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 2,906 ms
コンパイル使用メモリ 65,024 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 03:13:00
合計ジャッジ時間 3,578 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
var
    N = stdin.readline.parseInt
    s : string
for n in 0..<N:
    s = stdin.readline
    var
        w,g,r,w2 : int
    for c in s:
        if c == 'W':
            w += 1
            w2 += 1
        if c == 'G':
            w = 0
            if w2 > 0:
                w2 -= 1
            else:
                w = 1
                break
            g += 1
        if c == 'R':
            g -= 1
        if g < 0:
            break
    if w == 0 and g == 0:
        echo "possible"
    else:
        echo "impossible"
0