QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404556#8224. Caught in the Middlewxqwq0 1ms3732kbC++14819b2024-05-04 08:19:222024-05-04 08:19:24

Judging History

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

  • [2024-05-04 08:19:24]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3732kb
  • [2024-05-04 08:19:22]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

inline int read()
{
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0' || ch>'9') {if(ch=='-') f=1;ch=getchar();}
	while(ch>='0' && ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return f?-x:x;
}

#define x first
#define y second
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ull;
const int N=1e6+10;

int n,top;
char str[N];

int main()
{
	int T=read();
	while(T--) {
		n=read(),top=0;
		scanf("%s",str+1);
		
		bool ans=1;
		for(int i=1;i<=n;i++) {
			if(str[i]=='R') ++top;
			else if(!top) ans=0;
			else top--;
		}
		if(ans) puts("Bob");
		else puts("Alice");
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3732kb

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'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%