結果
| 問題 |
No.154 市バス
|
| ユーザー |
lapi
|
| 提出日時 | 2019-07-01 20:46:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 985 bytes |
| コンパイル時間 | 913 ms |
| コンパイル使用メモリ | 103,908 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 05:45:24 |
| 合計ジャッジ時間 | 1,495 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 3 WA * 5 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
string S[1000];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N; cin >> N;
for (int i = 0; i < N; i++) cin >> S[i];
for (int i = 0; i < N; i++) {
int cntW, cntG, cntR;
cntW = cntG = cntR = 0;
bool flag = true;
for (int j = S[i].size()-1; j >=0 && flag; j--) {
if (S[i][j] == 'W') {
cntG--;
}
if (S[i][j] == 'G') {
cntR--;
cntG++;
}
if (S[i][j] == 'R') cntR++;
if (cntR < 0 || cntG < 0) flag = false;
}
if (cntR > 0 && cntG > 0) flag = false;
if (flag) cout << "possible" << endl;
else cout << "impossible" << endl;
}
return 0;
}
lapi