货物搜集
货物搜集
题解
我们可以先更新出到某个点所需的最大武力值,再二分出总的最小武力值即可。
源码
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<vector>
#include<queue>
#define MAXN 1000005
using namespace std;
typedef long long LL;
int n,maxx[MAXN],Max,ans;
int to[MAXN],paid[MAXN],nxt[MAXN];
int tot,head[MAXN],a[MAXN];
LL W;
#define gc() getchar()
template<typename _T>
inline void read(_T &x)
{
_T f=1;x=0;char s=gc();
while(s>'9'||s<'0'){if(s=='-')f=-1;s=gc();}
while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=gc();}
x*=f;
}
void addEdge(int u,int v,int w)
{
to[++tot]=v;paid[tot]=w;
nxt[tot]=head[u];he

浙公网安备 33010602011771号