結果
問題 | No.154 市バス |
ユーザー | hogeover30 |
提出日時 | 2015-02-17 23:53:03 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 52,176 KB |
最終ジャッジ日時 | 2023-08-03 09:02:18 |
合計ジャッジ時間 | 937 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:9: error: ‘vector’ was not declared in this scope vector<int> v; ^~~~~~ main.cpp:11:9: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? main.cpp:4:1: +#include <vector> using namespace std; main.cpp:11:9: vector<int> v; ^~~~~~ main.cpp:11:16: error: expected primary-expression before ‘int’ vector<int> v; ^~~ main.cpp:15:17: error: ‘v’ was not declared in this scope v.push_back(1); ^ main.cpp:18:35: error: ‘v’ was not declared in this scope auto k=find(begin(v), end(v), 1); ^ main.cpp:23:35: error: ‘v’ was not declared in this scope auto k=find(begin(v), end(v), 3); ^ main.cpp:31:20: error: ‘v’ was not declared in this scope 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; } }