結果
問題 | No.154 市バス |
ユーザー | hogeki |
提出日時 | 2017-07-16 23:47:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,039 bytes |
コンパイル時間 | 790 ms |
コンパイル使用メモリ | 109,580 KB |
実行使用メモリ | 31,176 KB |
最終ジャッジ日時 | 2024-04-21 10:17:37 |
合計ジャッジ時間 | 1,741 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 46 ms
22,912 KB |
testcase_01 | AC | 45 ms
22,784 KB |
testcase_02 | AC | 46 ms
22,784 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 24 ms
17,408 KB |
testcase_06 | AC | 24 ms
17,280 KB |
testcase_07 | AC | 40 ms
22,912 KB |
testcase_08 | WA | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Problem154 { class Program { static void Main(string[] args) { int T = int.Parse(Console.ReadLine()); string[] S = new string[T]; for (int i = 0; i < T; i++) S[i] = Console.ReadLine(); for(int i = 0; i < T; i++) { int wcount = 0; int gcount = 0; int wright = 0; int gright = 0; for(int j = 0; j < S[i].Length; j++) { char s = S[i][j]; if (s == 'W') { wcount++; wright = j; } else if(s == 'G') { gright = j; if(--wcount < 0) { Console.WriteLine("impossible"); break; } else { gcount++; } } else if(s == 'R') { if(--gcount < 0) { Console.WriteLine("impossible"); break; } } } if (wright >= gright) { Console.WriteLine("impossible"); } else { if (gcount == 0) { Console.WriteLine("possible"); } else if (gcount > 0) { Console.WriteLine("impossible"); } } } } } }