QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#684966 | #8287. Caught in the Middle | Joyeuse_Ordre# | WA | 0ms | 1352kb | C++14 | 513b | 2024-10-28 16:50:00 | 2024-10-28 16:50:01 |
Judging History
answer
#include<cstdio>
const int MAXN = 1e6 + 5;
char S[MAXN];
void solve(){
int n; scanf("%d", &n);
for(int i=1;i<=n;i++) scanf("\n%c",S+i);
S[n + 1] = '\0';
int begin = 1, end = n, totL = 0, totR = 0;
while(S[begin] == 'R' && begin <= n) ++begin, ++totL;
while(S[end] == 'L' && end >= 1) --end, ++totR;
puts((totL + totR & 1) || totL + totR <= 1 || totL == n || totR == n ? "Alice" : "Bob");
}
int main(){
int T; scanf("%d", &T);
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1352kb
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 Alice Alice Alice Bob Alice Alice Bob Alice Alice Bob Alice Alice Bob Bob Alice Alice
result:
wrong answer 8th lines differ - expected: 'Alice', found: 'Bob'