QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650844#8287. Caught in the Middleshiqiaqiaya#WA 0ms3480kbC++20808b2024-10-18 16:45:272024-10-18 16:45:28

Judging History

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

  • [2024-10-18 16:45:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3480kb
  • [2024-10-18 16:45:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<pair<char, int>> a;
    for (int i = 0; i < n; i++) {
        int j = i;
        while (j + 1 < n && s[j + 1] == s[i]) j++;
        a.push_back({s[i], j - i + 1});
        i = j;
    }
    
    char op = 'R';
    if ((a.size() & 1) || a[0].first == 'L') {
        cout << "Alice\n";
        return;
    }

    for (int i = 0; i < a.size(); i += 2) {
        if (a[i].second != a[i + 1].second) {
            cout << "Alice\n";
            return;
        }
    }

    cout << "Bob\n";
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while (T--) solve();
    return 0 ;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3480kb

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
Alice
Alice
Alice
Alice
Alice
Alice
Bob
Alice
Alice
Alice

result:

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