您当前的位置: 首页 > 

MangataTS

暂无认证

  • 0浏览

    0关注

    423博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

智乃的密码(双指针)

MangataTS 发布时间:2022-02-05 16:07:18 ,浏览量:0

题目连接

https://ac.nowcoder.com/acm/contest/23478/I

题面

在这里插入图片描述

思路

我们通过双指针枚举一下可行的区间,那么对于这个可行区间,的所有右边界在 [ l o c , s t a r t + R ] [loc,start+R] [loc,start+R]范围内的字符串都满足那么我们直接每找到一个可行字符串,就把后面的贡献加上就能在线性时间复杂度计算出结果了,详情请看代码

代码
#include
using namespace std;
//----------------自定义部分----------------
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair

int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};

ll ksm(ll a,ll b) {
	ll ans = 1;
	for(;b;b>>=1LL) {
		if(b & 1) ans = ans * a % mod;
		a = a * a % mod;
	}
	return ans;
}

ll lowbit(ll x){return -x & x;}

const int N = 2e6+10;
//----------------自定义部分----------------
int n,l,r,m,q,a[N];
char s[N];
int cal[5];
bool check(){
	int ans = 0;
	int res = 0;
	for(int i = 1;i = 3 && res >= l && res = 3;
}

int get(int i){
	if(s[i] >= 'A' && s[i] = 'a' && s[i] = '0' && s[i] >n>>l>>r;
	cin>>(s+1);
	for(int i = 1;i  n) j--;
		if((j-i+1)             
关注
打赏
1665836431
查看更多评论
0.0508s