当前位置:网站首页>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;
}
边栏推荐
- 过拟合与正则化
- [binary search] 69 Square root of X
- Sword finger offer 53 - ii Missing numbers from 0 to n-1
- 个人开发的渗透测试工具Satania v1.2更新
- Add level control and logger level control of Solon logging plug-in
- Light a light with stm32
- [to be continued] [UE4 notes] L3 import resources and project migration
- Kubedm series-00-overview
- The number of enclaves
- [speed pointer] 142 circular linked list II
猜你喜欢

The present is a gift from heaven -- a film review of the journey of the soul

On-off and on-off of quality system construction

C language Essay 1

Sword finger offer 09 Implementing queues with two stacks

Pointnet++的改进

一个新的微型ORM开源框架

用STM32点个灯
![[turn]: OSGi specification in simple terms](/img/54/d73a8d3e375dfe430c2eca39617b9c.png)
[turn]: OSGi specification in simple terms

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

剑指 Offer 53 - I. 在排序数组中查找数字 I
随机推荐
Under the national teacher qualification certificate in the first half of 2022
Sword finger offer 04 Search in two-dimensional array
Reflection summary of Haut OJ freshmen on Wednesday
Haut OJ 1221: a tired day
Sword finger offer 05 Replace spaces
Software test -- 0 sequence
用STM32点个灯
[to be continued] [UE4 notes] L2 interface introduction
Introduction to tools in TF-A
第六章 数据流建模—课后习题
FVP和Juno平台的Memory Layout介绍
Add level control and logger level control of Solon logging plug-in
Drawing dynamic 3D circle with pure C language
剑指 Offer 05. 替换空格
Hang wait lock vs spin lock (where both are used)
Graduation project of game mall
Binary search basis
个人开发的渗透测试工具Satania v1.2更新
lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
Pointnet++ learning