题面:
题解:
人丑常数大。。。一个log的LCT,比两个log的线段树分治还要慢。
代码:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<list>
#include<ctime>
#define ui unsigned int
#define ll long long
#define llu unsigned ll
#define ld long double
#define pr make_pair
#define pb push_back
#define lc (cnt<<1)
#define rc (cnt<<1|1)
#define len(x) (t[(x)].r-t[(x)].l+1)
#define tmid ((l+r)>>1)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
using namespace std;
const int inf=0x3f3f3f3f;
const ll lnf=0x3f3f3f3f3f3f3f3f;
const double dnf=1e18;
const int mod=1e9+7;
const double eps=1e-1;
const double pi=acos(-1.0);
const int hp=13331;
const int maxn=550100;
const int maxp=800100;
const int maxm=1000100;
const int up=200000;
struct tree
{
int son[2];
int fa,minn,si,rev;
}t[maxn];
int st[maxn];
int deltime[maxn],isdel[maxn];
int n,m;
int idin[maxn];
struct node
{
int x,y;
int begintime,endtime;
int id;
node(){
}
node(int a,int b,int c,int d,int e)
{
x=a,y=b,begintime=c,endtime=d,id=e;
}
}in[maxn],out[maxn];
bool cmpin(const node &a,const node &b)
{
return a.begintime<b.begintime;
}
bool cmpout(const node &a,const node &b)
{
return a.endtime<b.endtime;
}
struct nn
{
int x,y,id;
nn(){
}
nn(int a,int b,int c)
{
x=a,y=b,id=c;
}
};
vector<nn>vc[maxn];
int ans[maxn];
map<pair<int,int>,int>mp;
void pushup(