当前位置:网站首页>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;
}
边栏推荐
- Gbase database helps the development of digital finance in the Bay Area
- Csp-j-2020-excellent split multiple solutions
- 【Jailhouse 文章】Look Mum, no VM Exits
- Haut OJ 1243: simple mathematical problems
- Demonstration of using Solon auth authentication framework (simpler authentication framework)
- 【ES实战】ES上的native realm安全方式使用
- On-off and on-off of quality system construction
- 注解与反射
- [to be continued] [UE4 notes] L2 interface introduction
- 【Jailhouse 文章】Performance measurements for hypervisors on embedded ARM processors
猜你喜欢

剑指 Offer 53 - II. 0~n-1中缺失的数字
![[to be continued] [UE4 notes] L1 create and configure items](/img/20/54ba719be2e51b7db5b7645b361e26.jpg)
[to be continued] [UE4 notes] L1 create and configure items

游戏商城毕业设计

剑指 Offer 05. 替换空格
![[interval problem] 435 Non overlapping interval](/img/a3/2911ee72635b93b6430c2efd05ec9a.jpg)
[interval problem] 435 Non overlapping interval

一个新的微型ORM开源框架
![[merge array] 88 merge two ordered arrays](/img/e9/a73d9f22eead8e68c1e45c27ff6e6c.jpg)
[merge array] 88 merge two ordered arrays

Gbase database helps the development of digital finance in the Bay Area

Sword finger offer 53 - ii Missing numbers from 0 to n-1

A misunderstanding about the console window
随机推荐
PMP candidates, please check the precautions for PMP examination in July
A preliminary study of sdei - see the essence through transactions
Corridor and bridge distribution (csp-s-2021-t1) popular problem solution
常见的最优化方法
剑指 Offer 04. 二维数组中的查找
Improvement of pointnet++
注解与反射
Sword finger offer 53 - ii Missing numbers from 0 to n-1
[to be continued] [UE4 notes] L1 create and configure items
High precision subtraction
Haut OJ 1243: simple mathematical problems
SSH password free login settings and use scripts to SSH login and execute instructions
[binary search] 69 Square root of X
kubeadm系列-00-overview
[binary search] 34 Find the first and last positions of elements in a sorted array
SAP method of modifying system table data
Annotation and reflection
Kubedm series-00-overview
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
利用HashMap实现简单缓存