E. Exchanging Gifts
大佬的博客
#include<bits/stdc++.h>
using namespace std;
const int mx=1000100;
#define ll long long
vector<int> ve[mx],vec[mx];
unordered_map<int,ll>mp;
int in[mx];
ll op[mx];
ll cnt[mx];
bool vis[mx];
ll n;
#define tpyeinput ll //输入类型
inline char nc() {
static char buf[1000000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF: