結果

問題 No.154 市バス
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-13 01:13:03
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 148,440 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 18:26:07
合計ジャッジ時間 3,049 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,352 KB
testcase_01 AC 17 ms
4,352 KB
testcase_02 AC 17 ms
4,352 KB
testcase_03 AC 17 ms
4,352 KB
testcase_04 AC 17 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 13 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var t: int :: cui@inputInt()
	for(1, t)
		var s: []char :: cui@input()
		do s.reverse()
		var r: int :: 0
		var g: int :: 0
		var w: int :: 0
		var ans: bool :: true
		var ok: bool :: false
		for i(0, ^s - 1)
			switch(s[i])
			case 'R'
				do r :+ 1
			case 'G'
				do g :+ 1
				if(r < g)
					do ans :: false
				end if
				do ok :: true
			case 'W'
				if(!ok & (r = 0 | g = 0))
					do ans :: false
				elif(r <> 0 & g <> 0)
					do r :- 1
					do g :- 1
				end if
			end switch
		end for
		if(r <> 0 | g <> 0)
			do ans :: false
		end if
		do cui@print((ans ?("possible", "impossible")) ~ "\n")
	end for
end func
0