QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#631785#8287. Caught in the MiddleDBsoleil#WA 1ms3592kbC++23443b2024-10-12 10:16:302024-10-12 10:16:35

Judging History

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

  • [2024-10-12 10:16:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2024-10-12 10:16:30]
  • 提交

answer


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

int main(void) {
  cin.tie(nullptr)->sync_with_stdio(false);
  int tests;
  cin >> tests;
  while (tests--) {
    int n, c = 0, ans = 1; cin >> n;    
    string s; cin >> s;
    ans &= (c == 0);
    for (int i = 0; i < n; ++i) {
      c += (s[i] == 'R') - (s[i] == 'L');
      ans &= (c >= 0);
    }
    cout << (ans == 1 ? "Bob" : "Alice") << endl;
  }
  return 0;
} // main

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

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:

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

result:

wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'