开O2才可以进1s
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int P;
using i64 = long long;
// assume -P <= x < 2P
int norm(int x) {
if (x < 0) {
x += P;
}
if (x >= P) {
x -=
把lamda函数换成模板函数可以降到C++17
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template < typename T, auto op, T e, typename F, auto mapping, auto composition,
F e1 >
class segtree
{
int n;
vector< T > v;
vector< F > lazy;
参考:将线段树封装成模板
线段树封装成模板需要C++20 :)
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template < typename T, auto op, T e, typename F, auto mapping, auto composition,
F e1 >
class segtree
{
int n;
vector< T > v;
vector< F >