QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344415 | #8237. Sugar Sweet II | mendicillin2# | WA | 0ms | 3776kb | C++17 | 648b | 2024-03-04 15:08:29 | 2024-03-04 15:08:31 |
Judging History
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