結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-16 23:47:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,039 bytes |
| コンパイル時間 | 872 ms |
| コンパイル使用メモリ | 104,192 KB |
| 実行使用メモリ | 23,040 KB |
| 最終ジャッジ日時 | 2024-10-13 09:04:51 |
| 合計ジャッジ時間 | 1,617 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
コンパイルメッセージ
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");
}
}
}
}
}
}