結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
airuai
|
| 提出日時 | 2017-02-05 21:14:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 578 bytes |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 59,224 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 08:56:53 |
| 合計ジャッジ時間 | 945 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:33: warning: ‘s’ is used uninitialized [-Wuninitialized]
5 | #define rep(n) for(int i = 0; i < n; ++i)
| ^
main.cpp:8:16: note: ‘s’ was declared here
8 | int t, s, c = 0;
| ^
ソースコード
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#define rep(n) for(int i = 0; i < n; ++i)
using namespace std;
int main(void) {
int t, s, c = 0;
cin >> t;
rep(s) {
bool flag = true;
string str;
cin >> str;
rep(str.size()) {
if (str[i] == 'G') {
++c;
}
else if (str[i] == 'R') {
--c;
}
if (c < 0) {
flag = false;
break;
}
}
if (flag) {
if (c == 0) {
cout << "possible" << endl;
}
else {
cout << "impossible" << endl;
}
}
else {
cout << "impossible" << endl;
}
return 0;
}
}
airuai