当前位置:网站首页>Fried chicken nuggets and fifa22
Fried chicken nuggets and fifa22
2022-07-05 05:31:00 【solemntee】
Consider doubling
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int st[200005][3][20];
char s[200005];
int main()
{
int n,q;
scanf("%d%d",&n,&q);
scanf("%s",s+1);
for(int i=1;i<=n;i++)
for(int j=0;j<=2;j++)
{
if(s[i]=='W')st[i][j][0]=1;
else if(s[i]=='L')
{
if(j==0)st[i][j][0]=0;
else st[i][j][0]=-1;
}
else st[i][j][0]=0;
}
for(int j=1;j<=19;j++)
for(int i=1;i<=n;i++)
for(int k=0;k<=2;k++)
{
int t=((k+st[i][k][j-1])%3+3)%3;
if(i+(1<<j)<=n+1)
{
st[i][k][j]=st[i][k][j-1]+st[i+(1<<(j-1))][t][j-1];
}
}
for(int i=1;i<=q;i++)
{
int l,r,s;
scanf("%d%d%d",&l,&r,&s);
int nowpos=l;
while(nowpos<r+1)
{
// cout<<nowpos<<endl;
int ts=(s%3+3)%3;
for(int j=19;j>=0;j--)
{
if(nowpos+(1<<j)<=r+1)
{
s+=st[nowpos][ts][j];
nowpos=nowpos+(1<<j);
break;
}
}
}
printf("%d\n",s);
}
return 0;
}
边栏推荐
- Add level control and logger level control of Solon logging plug-in
- Haut OJ 1357: lunch question (I) -- high precision multiplication
- 过拟合与正则化
- kubeadm系列-01-preflight究竟有多少check
- Haut OJ 1241: League activities of class XXX
- [turn to] MySQL operation practice (III): table connection
- PMP candidates, please check the precautions for PMP examination in July
- FVP和Juno平台的Memory Layout介绍
- 服务熔断 Hystrix
- 剑指 Offer 06.从头到尾打印链表
猜你喜欢

【Jailhouse 文章】Look Mum, no VM Exits

剑指 Offer 53 - II. 0~n-1中缺失的数字

Improvement of pointnet++
![[to be continued] [UE4 notes] L3 import resources and project migration](/img/81/6f75f8fbe60e037b45db2037d87bcf.jpg)
[to be continued] [UE4 notes] L3 import resources and project migration

Sword finger offer 35 Replication of complex linked list

质量体系建设之路的分分合合

Corridor and bridge distribution (csp-s-2021-t1) popular problem solution

Palindrome (csp-s-2021-palin) solution

Talking about JVM (frequent interview)

Acwing 4300. Two operations
随机推荐
MySQL数据库(一)
个人开发的渗透测试工具Satania v1.2更新
【Jailhouse 文章】Jailhouse Hypervisor
The present is a gift from heaven -- a film review of the journey of the soul
Pointnet++ learning
[speed pointer] 142 circular linked list II
Gbase database helps the development of digital finance in the Bay Area
【Jailhouse 文章】Performance measurements for hypervisors on embedded ARM processors
【Jailhouse 文章】Look Mum, no VM Exits
剑指 Offer 53 - II. 0~n-1中缺失的数字
Haut OJ 2021 freshmen week II reflection summary
Haut OJ 1347: addition of choice -- high progress addition
Solon Auth 认证框架使用演示(更简单的认证框架)
Haut OJ 1352: string of choice
High precision subtraction
Sword finger offer 06 Print linked list from beginning to end
全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
[binary search] 34 Find the first and last positions of elements in a sorted array
kubeadm系列-01-preflight究竟有多少check
Reflection summary of Haut OJ freshmen on Wednesday