QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325797 | #8224. Caught in the Middle | winter2020 | 0 | 0ms | 3576kb | C++14 | 1.1kb | 2024-02-11 23:17:31 | 2024-02-11 23:17:31 |
answer
#include <iostream>
#include <cstring>
using namespace std;
int n;
string s;
bool check(string t) {
for (int i = 0; i < t.size() - 1; i ++ )
if (t[i] == t[i + 1]) return false;
return true;
}
void solve() {
cin >> n >> s;
if (n == 1) {
puts("Alice");
return;
}
if (check(s)) puts("Bob");
else {
int pos = -1;
for (int i = 0; i < n - 1; i ++ )
if (s[i] == s[i + 1] && s[i] == 'R') pos = i;
if (pos != -1) {
if (check(s.substr(pos + 1))) {
puts("Alice");
return;
}
}
pos = -1;
for (int i = 0; i < n - 1; i ++ )
if (s[i] == s[i + 1] && s[i] == 'L') {
pos = i + 1;
break;
}
if (pos != -1) {
if (check(s.substr(0, pos))) {
puts("Alice");
return;
}
}
puts("Bob");
return;
}
}
int main() {
int T;
cin >> T;
while (T -- ) solve();
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
20 10 RLRRRRLLRR 10 LRLLLLRRLR 6 RLRLRL 10 LLRLRRRRLR 6 LRRLLL 3 RLR 5 LLRRR 6 RRRRRL 9 LRRRLRRLR 1 R 10 RRRLLRRLLL 6 LRLLLR 9 LLRLRLRLR 7 RRRRLRR 2 LL 10 RRRLLRRLRR 2 RL 7 RRLRRLR 3 LLR 10 LLRLRRRLLR
output:
Alice Alice Bob Alice Bob Bob Alice Alice Alice Alice Bob Alice Alice Alice Alice Alice Bob Alice Alice Alice
result:
wrong answer 5th lines differ - expected: 'Alice', found: 'Bob'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%