当前位置:网站首页>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 basis
- Solon Auth 认证框架使用演示(更简单的认证框架)
- Pointnet++ learning
- Sword finger offer 05 Replace spaces
- [to be continued] [UE4 notes] L2 interface introduction
- Romance of programmers on Valentine's Day
- 挂起等待锁 vs 自旋锁(两者的使用场合)
- Zheng Qing 21 ACM is fun. (3) part of the problem solution and summary
- lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
猜你喜欢
![To be continued] [UE4 notes] L4 object editing](/img/0f/cfe788f07423222f9eed90f4cece7d.jpg)
To be continued] [UE4 notes] L4 object editing

Little known skills of Task Manager

YOLOv5添加注意力機制
![[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

Binary search basis

A new micro ORM open source framework

Sword finger offer 09 Implementing queues with two stacks

剑指 Offer 05. 替换空格

剑指 Offer 53 - I. 在排序数组中查找数字 I

lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
随机推荐
[to be continued] I believe that everyone has the right to choose their own way of life - written in front of the art column
每日一题-无重复字符的最长子串
Haut OJ 1316: sister choice buys candy III
[allocation problem] 455 Distribute cookies
Yolov5 ajouter un mécanisme d'attention
Haut OJ 1401: praise energy
After setting up the database and website When you open the app for testing, it shows that the server is being maintained
Introduction to tools in TF-A
Gbase database helps the development of digital finance in the Bay Area
Solon Logging 插件的添加器级别控制和日志器的级别控制
Improvement of pointnet++
Annotation and reflection
ALU逻辑运算单元
卷积神经网络简介
Haut OJ 1218: maximum continuous sub segment sum
用STM32点个灯
C language Essay 1
每日一题-搜索二维矩阵ps二维数组的查找
游戏商城毕业设计
Corridor and bridge distribution (csp-s-2021-t1) popular problem solution