QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#865132 | #8224. Caught in the Middle | thangthang# | 0 | 0ms | 3712kb | C++14 | 858b | 2025-01-21 15:17:09 | 2025-01-21 15:17:10 |
answer
#include <bits/stdc++.h>
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;
}
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: 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%