結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-06-12 01:49:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 742 bytes |
| コンパイル時間 | 430 ms |
| コンパイル使用メモリ | 59,076 KB |
| 最終ジャッジ日時 | 2024-11-14 19:45:19 |
| 合計ジャッジ時間 | 804 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:14:9: error: 'vector' was not declared in this scope
14 | vector<int> a;
| ^~~~~~
main.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
2 | #include <algorithm>
+++ |+#include <vector>
3 | #include <string>
main.cpp:14:16: error: expected primary-expression before 'int'
14 | vector<int> a;
| ^~~
main.cpp:17:17: error: 'a' was not declared in this scope
17 | a.push_back(0);
| ^
main.cpp:21:35: error: 'a' was not declared in this scope
21 | auto t=find(begin(a), end(a), k);
| ^
main.cpp:28:25: error: 'a' was not declared in this scope
28 | if (count(begin(a), end(a), 2)!=a.size()) res=false;
| ^
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int T; cin>>T;
while (T--) {
string s; cin>>s;
reverse(begin(s), end(s));
bool res=true;
vector<int> a;
for(auto& c: s) {
if (c=='R') {
a.push_back(0);
}
else {
int k=c=='W';
auto t=find(begin(a), end(a), k);
if (t==end(a) and (!k or find(begin(a), end(a), 2)==end(a)))
res=false;
else
*t=k+1;
}
}
if (count(begin(a), end(a), 2)!=a.size()) res=false;
cout<<(res ? "possible" : "impossible")<<endl;
}
}
hogeover30