結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2019-08-24 20:33:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 2,126 ms |
コンパイル使用メモリ | 192,316 KB |
最終ジャッジ日時 | 2025-01-07 14:51:31 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 7 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:23:18: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized] 23 | if (!f||l!='G') { | ~^~~~~ main.cpp:13:14: note: ‘l’ was declared here 13 | char l; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t; cin>>t; while (t--) { string s; cin>>s; int w=0,g=0,r=0; bool f=true; char l; for (char c:s) { if (c=='W') w++,l=c; else if (c=='G') g++,l=c; else r++; if (w<g||g<r) { f=false; break; } } if (!f||l!='G') { puts("impossible"); } else { puts("possible"); } } return 0; }