QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#338849#8224. Caught in the MiddleHYX11240 0ms3652kbC++171001b2024-02-26 13:30:252024-02-26 13:30:26

Judging History

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

  • [2024-02-26 13:30:26]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3652kb
  • [2024-02-26 13:30:25]
  • 提交

answer

#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "lib.h"
#endif
#define rep(i, min, max) for(int i = (min); i <= (max); ++i)
#define nrep(i, max, min) for(int i = (max); i >= (min); --i)
#define reads(str) (scanf("%s", str + 1), strlen(str + 1))
#define case() int Ts = read(); rep(T, 1, Ts)
#define putf(flag) puts((flag) ? "YES" : "NO")
#define put(x) printf("%d ", x)
#define putl(x) printf("%lld ", x)
#define endl() putchar('\n')
using namespace std;

typedef long long ll;
inline int read()
{
    int now=0; bool nev=false; char c=getchar();
    while(c<'0' || c>'9') { if(c=='-') nev=true; c=getchar(); }
    while(c>='0' && c<='9') { now=(now<<1)+(now<<3)+(c&15); c=getchar(); }
    return nev?-now:now;
}

const int N = 1e6 + 10;

char s[N];

int main() {
    case() {
		int n = read();
		reads(s);
		bool fl = 1;
		int top = 0;
		rep(i, 1, n) {
			if(s[i] == 'R') top ++;
			else top --;
			fl &= top >= 0;
		}
		puts(fl ? "Bob" : "Alice");
	}
}

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: 3652kb

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%