結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2020-01-23 11:37:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 836 bytes |
| コンパイル時間 | 1,599 ms |
| コンパイル使用メモリ | 175,504 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 19:24:31 |
| 合計ジャッジ時間 | 2,641 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
signed main(){
int n; cin >> n;
for(int i = 0; i < n; i++){
string s; cin >> s;
map<char, int> mp;
mp['W'] = 0, mp['G'] = 0, mp['R'] = 0;
bool judge = true;
for(int j = 0; j < s.size(); j++){
if(s[j] == 'R'){
if(mp['G'] == mp['R']){
judge = false;
}else{
mp['R']++;
}
}
if(s[j] == 'G'){
mp['G']++;
if(mp['W'] == 0){
judge = false;
}else{
mp['W']--;
}
}
if(s[j] == 'W'){
mp['W']++;
}
}
if(judge && mp['G'] == mp['R'] && mp['G'] != 0){
cout << "possible" << endl;
}else{
cout << "impossible" << endl;
}
}
return 0;
}
oxyshower