結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
capythm
|
| 提出日時 | 2016-06-20 00:29:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 488 ms |
| コンパイル使用メモリ | 56,084 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 08:34:08 |
| 合計ジャッジ時間 | 1,365 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int T;
string S;
cin >> T;
for( int i=0; i<T; i++ ){
cin >> S;
int d[3] = {0,0,0};
bool f = true;
for( int i=S.size()-1; i>=0; i-- ){
switch( S[i] ){
case 'R':
d[0]++;
break;
case 'G':
if( d[0] == 0 ){
f = false;
} else {
d[0]--;
d[1]++;
}
break;
case 'W':
if( d[1] > 0 ){
d[1]--;
d[2]++;
} else if( d[2] == 0 ) {
f = false;
}
break;
}
if( !f ) break;
}
if( f ) cout << "possible" << endl;
else cout << "impossible" << endl;
}
}
capythm