当前位置:网站首页>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;
}
边栏推荐
- Cluster script of data warehouse project
- 【Jailhouse 文章】Jailhouse Hypervisor
- [turn]: Apache Felix framework configuration properties
- What is the agile proportion of PMP Exam? Dispel doubts
- Control Unit 控制部件
- Acwing 4301. Truncated sequence
- 记录QT内存泄漏的一种问题和解决方案
- Haut OJ 1316: sister choice buys candy III
- 数仓项目的集群脚本
- Kubedm series-00-overview
猜你喜欢
![[to be continued] [UE4 notes] L2 interface introduction](/img/0f/268c852b691bd7459785537f201a41.jpg)
[to be continued] [UE4 notes] L2 interface introduction

用STM32点个灯
![[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
![[turn]: OSGi specification in simple terms](/img/54/d73a8d3e375dfe430c2eca39617b9c.png)
[turn]: OSGi specification in simple terms

Sword finger offer 05 Replace spaces

Palindrome (csp-s-2021-palin) solution

Sword finger offer 09 Implementing queues with two stacks

lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8

Hang wait lock vs spin lock (where both are used)

sync. Interpretation of mutex source code
随机推荐
发现一个很好的 Solon 框架试手的教学视频(Solon,轻量级应用开发框架)
FVP和Juno平台的Memory Layout介绍
The present is a gift from heaven -- a film review of the journey of the soul
object serialization
kubeadm系列-02-kubelet的配置和启动
Haut OJ 1316: sister choice buys candy III
Add level control and logger level control of Solon logging plug-in
Csp-j-2020-excellent split multiple solutions
Solon 框架如何方便获取每个请求的响应时间?
Reflection summary of Haut OJ freshmen on Wednesday
Haut OJ 1321: mode problem of choice sister
Palindrome (csp-s-2021-palin) solution
软件测试 -- 0 序
Time complexity and space complexity
Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
动漫评分数据分析与可视化 与 IT行业招聘数据分析与可视化
[sum of two numbers] 169 sum of two numbers II - enter an ordered array
Fragment addition failed error lookup
剑指 Offer 06.从头到尾打印链表
Demonstration of using Solon auth authentication framework (simpler authentication framework)