当前位置:网站首页>Learn exkmp again (exkmp template)
Learn exkmp again (exkmp template)
2022-07-29 03:22:00 【Foolish last words】
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string s1 ,s2 ;
cin>>s1>>s2;
vector<int>z(s1.length() + s2.length() );
auto getz = [&](string s ){
int l = 0 ;
for(int i = 1; i < s.length() ; i ++){
if(l + z[l] > i ){
z[i] = min(z[i - l] , l + z[l] - i);
}
while(i + z[i] < s.length() && s[i + z[i]] == s[z[i]])z[i] ++;
if(i + z[i] > l + z[l])l = i ;
}
};
getz(s2 + s1);
z[0] = s2.length() + 1;
ll ansz = 0 ;
for(int i = 0; i < s2.length() ; i ++){
ansz ^= (ll)1*min((int)s2.length() - i + 1, (z[i] + 1) )*(i + 1);
}
ll ansp = 0;
for(int i = 0 ; i < s1.length() ; i ++){
ansp ^= (ll)1 * min((int)s2.length() + 1, z[i + s2.length()] + 1) *(i + 1);
}
cout<<ansz<<'\n'<<ansp<<'\n';
return 0 ;
}边栏推荐
猜你喜欢

Producer consumer model of concurrent model

力扣刷题之分数加减运算(每日一题7/27)

How to solve the time zone problem in MySQL timestamp

2022-07-28 第四小组 修身课 学习笔记(every day)

【科技1】

Flask的创建的流程day05-06之创建项目

Mathematical modeling -- analytic hierarchy process model

During the year, the first "three consecutive falls" of No. 95 gasoline returned to the "8 Yuan era"“
![[freeswitch development practice] media bug obtains call voice flow](/img/14/9a359403606c312b30733d4a015fa5.png)
[freeswitch development practice] media bug obtains call voice flow

Implement Lmax disruptor queue from scratch (VI) analysis of the principle of disruptor solving pseudo sharing and consumers' elegant stopping
随机推荐
What if MySQL forgets the password
Several methods of converting object to string
Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it
Singleton mode (hungry and lazy)
Asynchronous callback future mode of concurrent mode
How close can QA be to business code QA conducts testability transformation on business code
3D advanced renderer: artlandis studio 2021.2 Chinese version
GJB常见混淆概念
简历竟然敢写精通并发编程,那你说说AQS为什么要用双向链表?
Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.
C traps and defects Chapter 3 semantic "traps" 3.4 avoid "couple method"
ROS - create workspace
i. MX 8m plus integrated dedicated neural processing engine (NPU)
Digital image processing Chapter 10 - image segmentation
How to solve the time zone problem in MySQL timestamp
01-SDRAM:初始化模块的代码
C traps and defects Chapter 3 semantic "traps" 3.8 operators &, |, and!
【科技1】
照片比例校正工具:DxO ViewPoint 3 直装版
军品研制过程-转阶段