QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#78441 | #5516. Modern Machine | DerekFeng | 0 | 2ms | 3612kb | C++ | 638b | 2023-02-18 22:33:27 | 2023-02-18 22:33:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m,q,a[100004],b[100004];
char s[100004];
int L[100004],R[100004],A,B;
void sol(int x){
a[x]=1,A=B=0;
for(int i=1;i<=x;i++)if(a[i]==1)L[++A]=i;
for(int i=x+1;i<=n;i++)if(a[i]==0)R[++B]=i;
if(A>B)for(int i=L[A-B];i<=n;i++)a[i]=0;
else for(int i=1;i<=R[B-A+1];i++)a[i]=1;
}
int main(){
scanf("%d%d%s",&n,&m,s+1);
for(int i=1;i<=n;i++)a[i]=s[i]=='R';
for(int i=1;i<=m;i++)scanf("%d",&b[i]);
scanf("%d",&q);
while(q--){
int l,r;scanf("%d%d",&l,&r);
for(int i=l;i<=r;i++)sol(b[i]);
int cnt=0;
for(int i=1;i<=n;i++)cnt+=a[i];
printf("%d\n",cnt);
}
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 3
Accepted
time: 2ms
memory: 3588kb
input:
3 1 BBR 3 1 1 1
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3576kb
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: 0
Accepted
time: 2ms
memory: 3588kb
input:
10 1 RBBBBRRBBR 9 1 1 1
output:
3
result:
ok single line: '3'
Test #4:
score: -3
Wrong Answer
time: 1ms
memory: 3612kb
input:
10 10 RRRBBRRBRB 5 9 4 6 7 7 4 3 8 2 1 1 10
output:
9
result:
wrong answer 1st lines differ - expected: '1', found: '9'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
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
Runtime Error
Test #26:
score: 0
Runtime Error
input:
120000 120000 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...
output:
result:
Subtask #6:
score: 0
Runtime Error
Test #30:
score: 0
Runtime Error
input:
120000 120000 RRBBRBRBBBRBRRBRBRRRBRBRRBRRRBBRBBBBBBRBBRBRBRBRRBRBRBRRRBRBBBBRRBBRRBBRRRBRRBRBBRRRBBBRRBBBBRBBBRBBBRBBBRBBRBBBBRBBBBRRBRRRRRRRBRRRBRBBBRBBBBRBBRBRBRRBBRRBRBBBBRBBBRBBRRBBBBRBBBBRBRRBRBBRBBBBRRBBBBBBRBBRBBBBBBRBBRRRRRBBBRBBBRBRRBBRBRBRBBRRBRRBBBRBRBRRRBBRRBBRRRRBRRBBRRBBBBBBBRBBBRBBBR...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #1:
0%