比赛 |
2025暑期集训第6场 |
评测结果 |
AAAAAAAAAA |
题目名称 |
Cow Operations |
最终得分 |
100 |
用户昵称 |
KKZH |
运行时间 |
2.940 s |
代码语言 |
C++ |
内存使用 |
5.14 MiB |
提交时间 |
2025-07-12 08:55:59 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,o[N],w[N],c[N];
string a;
int main(){
freopen("operation.in","r",stdin);
freopen("operation.out","w",stdout);
cin>>a>>n;
for(int i=0;i<a.size();i++){
if(a[i]=='O') o[i+1]++;
if(a[i]=='W') w[i+1]++;
if(a[i]=='C') c[i+1]++;
c[i+1]+=c[i];
o[i+1]+=o[i];
w[i+1]+=w[i];
}
int x,y;
for(int i=1;i<=n;i++){
cin>>x>>y;
x--;
if((o[y]-o[x])%2==(w[y]-w[x])%2&&(o[y]-o[x])%2!=(c[y]-c[x])%2) cout<<"Y";
else cout<<"N";
}
return 0;
}