#pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include "bits/stdc++.h" #define MAXN 100009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<v; for(int i=1;i<=n;i++) v.pb(mp(dp[i],i)); for(int i=1;i<=n;i++) v.pb(mp(dp[i]+x,i+n)); sort(all(v));int now=1; for(int i=0;in) b[v[i].ss-n]=now; else a[v[i].ss]=now; } return dfs(1,0); } void travel(int nd,int pr){ sub[nd]=1; for(int i=0;i>1; if(solve(mid)=k) printf("%d\n",st); else printf("%d\n",en); return 0; }