当前位置:网站首页>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;
}
边栏推荐
- Improvement of pointnet++
- Solution to the palindrome string (Luogu p5041 haoi2009)
- Cluster script of data warehouse project
- 远程升级怕截胡?详解FOTA安全升级
- Daily question - longest substring without repeated characters
- kubeadm系列-00-overview
- Pointnet++ learning
- SSH password free login settings and use scripts to SSH login and execute instructions
- Haut OJ 1357: lunch question (I) -- high precision multiplication
- 卷积神经网络简介
猜你喜欢
TF-A中的工具介绍
游戏商城毕业设计
剑指 Offer 53 - II. 0~n-1中缺失的数字
To be continued] [UE4 notes] L4 object editing
剑指 Offer 58 - II. 左旋转字符串
浅谈JVM(面试常考)
Binary search basis
Solution to the palindrome string (Luogu p5041 haoi2009)
Sword finger offer 35 Replication of complex linked list
Codeforces round 712 (Div. 2) d. 3-coloring (construction)
随机推荐
Pointnet++ learning
个人开发的渗透测试工具Satania v1.2更新
Chapter 6 data flow modeling - after class exercises
远程升级怕截胡?详解FOTA安全升级
Talking about JVM (frequent interview)
Zzulioj 1673: b: clever characters???
PC寄存器
剑指 Offer 05. 替换空格
Haut OJ 1316: sister choice buys candy III
挂起等待锁 vs 自旋锁(两者的使用场合)
A new micro ORM open source framework
[binary search] 69 Square root of X
剑指 Offer 09. 用两个栈实现队列
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
剑指 Offer 04. 二维数组中的查找
Software test -- 0 sequence
注解与反射
Time complexity and space complexity
To the distance we have been looking for -- film review of "flying house journey"
质量体系建设之路的分分合合