QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#398262 | #8224. Caught in the Middle | Hetanggle | 0 | 0ms | 3628kb | C++14 | 747b | 2024-04-25 09:59:28 | 2024-04-25 09:59:30 |
answer
#include<bits/stdc++.h>
using namespace std;
int t,n;
string s;
int main(){
cin>>t;
while(t--){
cin>>n;
int l,r,flg=0;
cin>>s;
for(int i=0;i<n;i++){
if(s[i]=='R') r++;
else l++;
if(l>r){
flg=1;
cout<<"Alice"<<endl;
break;
}
}
l=0;
r=0;
for(int i=n-1;i>=0;i--){
if(s[i]=='R') r++;
else l++;
if(r>l){
flg=1;
cout<<"Alice"<<endl;
break;
}
}
if(!flg) cout<<"Bob"<<endl;
}
}/*
RLLLLLL
RL
RRRRRRL
RL
RRRLLLRRRLLLL
RLRLRLR
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
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 Alice Bob Alice Alice Alice Alice Alice Alice Alice Alice Alice Alice Bob Alice Alice Alice Alice Alice Alice Alice Alice Bob Alice Alice Alice Alice Alice
result:
wrong answer 3rd lines differ - expected: 'Bob', found: 'Alice'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%