QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#361027 | #8287. Caught in the Middle | paoxiaomo# | WA | 0ms | 3544kb | C++17 | 1.2kb | 2024-03-22 18:13:22 | 2024-03-22 18:13:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
string s;
cin >> n >> s;
int t = count(s.begin(), s.end(), 'L');
if (t == 0 || t == n)
{
cout << "Alice" << endl;
return;
}
int ll = -1, rr = -1;
for (int i = 0; i < n; i++)
{
if (s[i] == 'L')
{
ll = i + 1;
break;
}
}
for (int i = n - 1; i >= 0; i--)
{
if (s[i] == 'R')
{
rr = i + 1;
break;
}
}
if (ll == 1 || rr == n)
{
cout << "Alice" << endl;
return;
}
if (ll > rr)
{
if (n & 1)
{
cout << "Alice" << endl;
}
else
{
cout << "Bob" << endl;
}
return;
}
int tim = ll - 1 + n - rr;
cout << ll << " " << rr << endl;
if (tim & 1)
{
cout << "Alice" << endl;
}
else
{
cout << "Bob" << endl;
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while (T--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
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 2 5 Bob Alice Alice Alice Alice Bob Alice Alice 4 7 Bob Alice Alice Alice Alice Alice Bob Alice Alice Alice
result:
wrong answer 3rd lines differ - expected: 'Bob', found: '2 5'