結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2016-06-10 16:29:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 729 bytes |
コンパイル時間 | 1,428 ms |
コンパイル使用メモリ | 166,916 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:22:01 |
合計ジャッジ時間 | 2,036 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 3 |
ソースコード
#include <bits/stdc++.h> #define LL long long #define ULL unsigned long long #define REP(i,n) for(int i=0; i<(n); i++) #define REP2(i,x,n) for(int i=x; i<(n); i++) using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string S; REP( i, N ) { cin >> S; auto pos = S.find_last_of( 'R' ); if( S.find( 'G', pos + 1 ) != string::npos || S.find( 'W', pos + 1 ) != string::npos ) { cout << "impossible" << endl; continue; } int countG{},countR{}; REP( i, (int)S.size() ) { if( S[i] == 'G' ) { countG++; } if( S[i] == 'R') { countR++; } } cout << ( (countG > 0 && countR > 0 ) ? "possible" : "impossible" ) << endl; } return 0; }