QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#344415#8237. Sugar Sweet IImendicillin2#WA 0ms3776kbC++17648b2024-03-04 15:08:292024-03-04 15:08:31

Judging History

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

  • [2024-11-04 16:59:03]
  • hack成功,自动添加数据
  • (/hack/1109)
  • [2024-03-04 15:08:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3776kb
  • [2024-03-04 15:08:29]
  • 提交

answer

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

inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0' || c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0' && c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}

int n;
const int N=1e6+5;
char c[N];

int main()
{
	int T=read();
	while(T--)
	{
		n=read();
		scanf("%s",c+1);
		int now=0;
		bool flag=true;
		for(int i=1;i<=n;i++)
		{
			if(c[i]=='L') now--;
			else now++;
			if(now<0)
			{
				flag=false;
				break;
			}
		}
		if(now>0) flag=false;
		if(!flag) printf("Alice\n");
		else printf("Bob\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
4
2 5 5 2
4 2 1 3
3 2 1 4
3
5 4 3
1 1 1
6 6 6
3
5 4 3
2 3 1
1 2 3
5
2 1 3 2 1
5 1 1 3 4
1 3 4 2 4

output:

Alice
Alice
Alice
Alice

result:

wrong output format Expected integer, but "Alice" found