#include<bits/stdc++.h> #define LL long long #define pii pair<LL,int> #define mem(a,b) memset(a,b,sizeof(a)) using namespace std; const int maxn=5e4+5; const int inf=0x3f3f3f3f; const int MOD=201314; struct node{ int nm,z,id; bool f; }p[maxn<<1]; struct TMD{ int to,next...