当前位置:网站首页>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;
}
边栏推荐
- 剑指 Offer 09. 用两个栈实现队列
- 远程升级怕截胡?详解FOTA安全升级
- A misunderstanding about the console window
- Educational Codeforces Round 107 (Rated for Div. 2) E. Colorings and Dominoes
- Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
- 个人开发的渗透测试工具Satania v1.2更新
- How many checks does kubedm series-01-preflight have
- 卷积神经网络——卷积层
- kubeadm系列-02-kubelet的配置和启动
- Daily question - longest substring without repeated characters
猜你喜欢

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

Sword finger offer 09 Implementing queues with two stacks
![[to be continued] [UE4 notes] L1 create and configure items](/img/20/54ba719be2e51b7db5b7645b361e26.jpg)
[to be continued] [UE4 notes] L1 create and configure items

【Jailhouse 文章】Performance measurements for hypervisors on embedded ARM processors

读者写者模型

YOLOv5-Shufflenetv2

剑指 Offer 35.复杂链表的复制

一个新的微型ORM开源框架

Service fusing hystrix

Web APIs DOM node
随机推荐
[turn to] MySQL operation practice (I): Keywords & functions
Sword finger offer 53 - ii Missing numbers from 0 to n-1
浅谈JVM(面试常考)
Sword finger offer 06 Print linked list from beginning to end
kubeadm系列-00-overview
【Jailhouse 文章】Jailhouse Hypervisor
Alu logic operation unit
过拟合与正则化
Pointnet++学习
Haut OJ 1221: a tired day
[merge array] 88 merge two ordered arrays
Double pointer Foundation
全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
Zzulioj 1673: b: clever characters???
[turn to] MySQL operation practice (III): table connection
To be continued] [UE4 notes] L4 object editing
Time complexity and space complexity
游戏商城毕业设计
[allocation problem] 135 Distribute candy
YOLOv5添加注意力机制