QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#650287#5516. Modern Machineliuziao3 240ms3816kbC++231.1kb2024-10-18 14:27:382024-10-18 14:27:38

Judging History

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

  • [2024-10-18 14:27:38]
  • 评测
  • 测评结果:3
  • 用时:240ms
  • 内存:3816kb
  • [2024-10-18 14:27:38]
  • 提交

answer

#include <bits/stdc++.h>

// #define int int64_t

const int kMaxN = 1.2e5 + 5;

int n, m, q;
int a[kMaxN];
std::string str;

void update(std::string &s, int p) {
  if (p < 1 || p > n) return;
  if (s[p] == 'R') {
    s[p] = 'L', update(s, p + 1);
  } else {
    s[p] = 'R', update(s, p - 1);
  }
}

int solve(int l, int r) {
  std::string s = str;
  for (int i = l; i <= r; ++i) {
    s[a[i]] = 'R';
    update(s, a[i]);
  }
  return std::count(s.begin(), s.end(), 'R');
}

void dickdreamer() {
  std::cin >> n >> m >> str;
  for (auto c : str)
    if (c == 'B')
      c = 'L';
  str = " " + str;
  for (int i = 1; i <= m; ++i) std::cin >> a[i];
  std::cin >> q;
  for (int i = 1; i <= q; ++i) {
    int l, r;
    std::cin >> l >> r;
    std::cout << solve(l, r) << '\n';
  }
}

int32_t main() {
#ifdef ORZXKR
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  int T = 1;
  // std::cin >> T;
  while (T--) dickdreamer();
  // std::cerr << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}

詳細信息

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 0ms
memory: 3592kb

input:

3 1
BBR
3
1
1 1

output:

0

result:

ok single line: '0'

Test #2:

score: 3
Accepted
time: 0ms
memory: 3508kb

input:

3 10
BBB
3 3 3 1 3 3 3 3 3 1
1
2 5

output:

2

result:

ok single line: '2'

Test #3:

score: 3
Accepted
time: 0ms
memory: 3596kb

input:

10 1
RBBBBRRBBR
9
1
1 1

output:

3

result:

ok single line: '3'

Test #4:

score: 3
Accepted
time: 0ms
memory: 3568kb

input:

10 10
RRRBBRRBRB
5 9 4 6 7 7 4 3 8 2
1
1 10

output:

1

result:

ok single line: '1'

Test #5:

score: 3
Accepted
time: 0ms
memory: 3556kb

input:

300 300
BRRRRBBRBRBRBBBRBRRRBRBBRBBRRBBRBBRBRBRBRBBRRBBRBBRBBBBRRRRBRBRBBBBRBBBRBBRBBRBRBRRBRBBRRRRBRBBRRRBRRBRBBBRRRRBRRRBBBBRRBBRBBBRRRBRBBRBRBBRRBRBRRRBRBRBBBBRRBRBRRRRRBRRRRRBRRRBRBRRRRRBBBRRBBRBBRRRRBBBBRBRBBBRRRRBBBBBBBBBBRBRRBRBBRRRRBRBBRRRBBRBRRRBBRBRRBBRBBBBRBRBRBBBRBBRBRBBRBBRBRBRBRRRBBBBR...

output:

29

result:

ok single line: '29'

Test #6:

score: 3
Accepted
time: 6ms
memory: 3620kb

input:

300 300
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

149

result:

ok single line: '149'

Test #7:

score: 3
Accepted
time: 0ms
memory: 3816kb

input:

5 2
RBRBB
2 5
1
1 2

output:

4

result:

ok single line: '4'

Subtask #2:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #8:

score: 12
Accepted
time: 51ms
memory: 3776kb

input:

7000 7000
RRBRRRRRRBBRBRBRRRBRRRBRRRRBRBRBRBRBBBRBRRRBBBRBBBBBBRBBBRRBRBRBBRRRBBBBRRBBRBBRBBRRRBBRRBRBRRRRRBBRRBRBBBRBBRRRRBRBBBBRBBBBBBRRRBRBRBBRBRRBBBBBRRBBBBBBRBBBRRBBRRBBBBBBRBRBRBBRBBRBBBRRBRBBRBBBBBRBRRBRRBRRRBRBBBBBRRBRBRRBRRRRBBBBRRBBRRRRRBBBBBRRBBBBBBRRBBRBRRRRRRRBRRBRRBBBBBBBBRRRRBBRRRRRRR...

output:

5505

result:

ok single line: '5505'

Test #9:

score: 12
Accepted
time: 240ms
memory: 3656kb

input:

7000 7000
RRBRRRBBRRBBRBBBBRBRBRRBBBBBBBBBBRRRBRRBBRRRRBBRRBRRRRRBBRBBBBBRRBBBBRBBBBRBRBBBBBRBBRRRBBBBRRBRRBRRBRBBBRRRRBBRRBRRBRBBRBBBRBBBRRBRBBBRRBBBBBRBBRBRBRBBBBRRBBBRRRRBRRBBRBRBBBBBBRRRRRBBRRBBRRBBBRBBBRRRRRBRBBRBRBBRRBBRBRRRBBRRBBBRRBRRRRRRRBBRBRRBRBRBRBRBRBBRBRRBRBBBBBBBRRBRRRBBBBRRBBRRRBBRBR...

output:

5936

result:

ok single line: '5936'

Test #10:

score: 0
Time Limit Exceeded

input:

7000 7000
RBBRBRBRRRBBRBRRBRBBRBRRRBRBBBRBBRBRBRBRRBBBBRBRRRBBRRRRBBRRRRBBRBRBRRRRBBRRBBRBRBBBRBBBBBRBBRBBRRBBRRRRRBBRBRBRRBBRRRBRBBBRBRRBRRRBRRRBRBBBBRBBBBBBRBRRRBRRRBRBBBRBRRBBRRBRRBBBBBRBBRRRRBBRRBBBBRRBRBRRRRBBRRRRRBRBRRBBRRRRRBRRBRBBBBRRBBBBRBRRRBBRBRRRRRBRRBRRRBRRBRRRRRBBBRBBBRBRRRBRBBBBRRRRRR...

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Time Limit Exceeded

Test #21:

score: 0
Time Limit Exceeded

input:

10 120000
RRRRRRRRRR
9 1 9 6 1 9 6 10 3 2 6 4 2 5 7 10 8 9 2 6 7 10 2 9 7 5 9 9 2 7 4 1 8 3 3 6 9 4 7 9 6 8 8 2 5 6 8 3 9 2 5 2 5 9 8 4 8 3 2 2 5 1 9 1 7 9 9 4 9 5 2 10 7 4 3 8 1 10 7 6 6 2 3 8 7 8 5 9 2 2 1 10 2 2 5 4 2 5 9 1 8 4 5 1 2 8 3 10 10 6 7 2 1 5 10 1 9 10 1 7 3 10 8 10 6 8 3 1 10 9 10 5 5...

output:


result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #26:

score: 0
Time Limit Exceeded

input:

120000 120000
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:


result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #30:

score: 0
Time Limit Exceeded

input:

120000 120000
RRBBRBRBBBRBRRBRBRRRBRBRRBRRRBBRBBBBBBRBBRBRBRBRRBRBRBRRRBRBBBBRRBBRRBBRRRBRRBRBBRRRBBBRRBBBBRBBBRBBBRBBBRBBRBBBBRBBBBRRBRRRRRRRBRRRBRBBBRBBBBRBBRBRBRRBBRRBRBBBBRBBBRBBRRBBBBRBBBBRBRRBRBBRBBBBRRBBBBBBRBBRBBBBBBRBBRRRRRBBBRBBBRBRRBBRBRBRBBRRBRRBBBRBRBRRRBBRRBBRRRRBRRBBRRBBBBBBBRBBBRBBBR...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%