結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2015-06-09 12:42:21 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-10-13 07:29:18 |
合計ジャッジ時間 | 16,421 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 1 WA * 1 RE * 1 TLE * 5 |
ソースコード
# -*- coding:utf-8 -*- def solve(): s = raw_input() s = list(s) g = s.count("G") r = s.count("R") if g > r: print "impossible" return i = 1 gg = s[::-1].index("G") ww = s[::-1].index("W") if ww < gg: print "impossible" return while i <= g: gg = s[::-1].index("G") rr = s[::-1].index("R") if gg < rr: print "impossible" return s[len(s)-gg -1] = s[len(s) - rr -1] = "W" i += 1 print "possible" if __name__ == "__main__": n = input() for i in xrange(n): solve()