結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2015-02-17 23:53:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 53,152 KB |
最終ジャッジ日時 | 2024-11-14 19:00:08 |
合計ジャッジ時間 | 1,214 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:9: error: ‘vector’ was not declared in this scope 11 | vector<int> v; | ^~~~~~ main.cpp:4:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 3 | #include <algorithm> +++ |+#include <vector> 4 | using namespace std; main.cpp:11:16: error: expected primary-expression before ‘int’ 11 | vector<int> v; | ^~~ main.cpp:15:17: error: ‘v’ was not declared in this scope 15 | v.push_back(1); | ^ main.cpp:18:35: error: ‘v’ was not declared in this scope 18 | auto k=find(begin(v), end(v), 1); | ^ main.cpp:23:35: error: ‘v’ was not declared in this scope 23 | auto k=find(begin(v), end(v), 3); | ^ main.cpp:31:20: error: ‘v’ was not declared in this scope 31 | for(int a: v) if (a!=7) { possible=false; break; } | ^
ソースコード
#include <iostream>#include <string>#include <algorithm>using namespace std;int main(){int T; cin>>T;while (T--) {string s; cin>>s;int n=s.size();vector<int> v;bool possible=true;for(int i=n-1;i>=0;--i) {if (s[i]=='R') {v.push_back(1);}if (s[i]=='G') {auto k=find(begin(v), end(v), 1);if (k==end(v)) { possible=false; break; }*k|=2;}if (s[i]=='W') {auto k=find(begin(v), end(v), 3);if (k!=end(v)) { *k|=4; }else {k=find(begin(v), end(v), 7);if (k==end(v)) { possible=false; break; }}}}for(int a: v) if (a!=7) { possible=false; break; }cout<<(possible?"possible":"impossible")<<endl;}}