QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617089#8287. Caught in the Middlepengpeng_fudan#WA 1ms3728kbC++23637b2024-10-06 13:51:242024-10-06 13:51:25

Judging History

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

  • [2024-10-06 13:51:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3728kb
  • [2024-10-06 13:51:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 10;
int T;
int n;
char s[N];

bool check() {
    for (int i = 1; i <= n; ++i) {
        if (s[i] == s[n - i + 1]) {
            return 0;
        }
    }
    return 1;
}

void solve() {
    scanf("%d", &n);
    scanf("%s", s + 1);
    if (s[1] == 'L' || s[n] == 'R') {
        puts("Alice");
        return ;
    }
    if (check()) {
        puts("Bob");
        return ;
    }
    else {
        puts("Alice");
        return ;
    }
}

int main() {
    scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3660kb

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:

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

result:

ok 20 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3728kb

input:

20
7
LRLLRRR
8
LRLRLRRR
3
RLL
10
RLRLRLRLRL
10
RLRLRLRLRL
6
RLLLRL
10
RLRLRLRLLL
5
RLRRR
2
LL
10
RRRRLRLRLL
7
LLRRLLR
3
LRR
10
RRRRRLLLLL
10
RLRRRLRLRR
2
LR
6
RRLLLL
4
RRLR
10
LRLRLLRLRR
4
LRLL
10
RRLLRRRLLL

output:

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

result:

wrong answer 20th lines differ - expected: 'Bob', found: 'Alice'