QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#865133 | #8224. Caught in the Middle | thangthang# | 0 | 1ms | 3712kb | C++20 | 875b | 2025-01-21 15:19:44 | 2025-01-21 15:19:44 |
answer
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
const int N = 5e3 + 5;
int l[N], r[N], n;
string s;
void process(){
cin >> n;
cin >> s;
for (int i = 0; i < n; ++ i)
l[i] = n, r[i] = -1;
bool ok;
for (int i = n - 1; i >= 0; i --){
for (int j = i; j < n; ++ j){
ok = 0;
if (i == j) ok = 1;
else if (l[i] <= j || r[j] >= i) ok = 1;
if (ok == 0){
if (j < n - 1 && s[j + 1] == 'L') l[i] = min(l[i], j + 1);
if (i && s[i - 1] == 'R') r[j] = max(r[j], i - 1);
}
}
}
if (ok) cout << "Alice" << endl;
else cout << "Bob" << endl;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t; while (t --)
process();
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3712kb
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 Bob Alice Bob Alice Bob Alice
result:
wrong answer 15th 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%