QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387885#8287. Caught in the MiddleKLPP#WA 0ms3524kbC++14510b2024-04-12 22:52:432024-04-12 22:52:44

Judging History

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

  • [2024-04-12 22:52:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-04-12 22:52:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for (int i=a; i<b; i++)
#define trav(a,b) for (auto a:b)
#define all(x) begin(x),end(x)
#define lld long long

void solve() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=0;
	rep(i,0,n){
		if(s[i]=='R')cnt++;
		else cnt--;
		if(cnt<0){
			cout<<"Alice\n";
			return;
		}
	}
	cout<<"Bob\n";
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	cin >> tt;
	while (tt--) solve();
	return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3524kb

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:

Bob
Alice
Bob
Alice
Alice
Bob
Alice
Bob
Alice
Bob
Bob
Alice
Alice
Bob
Alice
Bob
Bob
Bob
Alice
Alice

result:

wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'