QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398262#8224. Caught in the MiddleHetanggle0 0ms3628kbC++14747b2024-04-25 09:59:282024-04-25 09:59:30

Judging History

你现在查看的是最新测评结果

  • [2024-04-25 09:59:30]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3628kb
  • [2024-04-25 09:59:28]
  • 提交

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%