一道傻吊的网络流题,wori我写的读入优化怎么老T?

远离读入优化报平安?

#include<bits/stdc++.h>
#define N 4005
#define inf 1000000007
using namespace std;
int head[*N],tot=,n,m,x,s,t,ans;
struct Edge{int u,v,next,f;}G[];
inline void addedge(int u,int v,int f){
G[tot].u=u;G[tot].v=v;G[tot].f=f;G[tot].next=head[u];head[u]=tot++;
G[tot].u=v;G[tot].v=u;G[tot].f=;G[tot].next=head[v];head[v]=tot++;
}
//struct Queue{
// int q[1000010],l,r;
// inline bool empty(){return l>r;}
// inline void push(int x){q[r++]=x;}
// inline void pop(){l++;}
// inline int front(){return q[l];}
// inline void clear(){l=0;r=0;}
//};
int level[];queue<int> q;
struct FastIO{
static const int S=;
int wpos;char wbuf[S];
FastIO():wpos() {}
inline int xchar(){
static char buf[S];
static int len=,pos=;
if(pos==len)pos=,len=fread(buf,,S,stdin);
if(pos==len)return -;
return buf[pos++];
}
inline int xuint(){
int c=xchar(),x=;
while(c<=&&~c)c=xchar();
if(c==-)return -;
for(;''<=c&&c<='';c=xchar())x=x*+c-'';
return x;
}
}io;
inline bool bfs(int s,int t){
queue<int>q;
memset(level,,sizeof(level));
q.push(s);level[s]=;
while(!q.empty()){
int u=q.front();q.pop();
if(u==t)return ;
for(int i=head[u];~i;i=G[i].next){
int v=G[i].v,f=G[i].f;
if(f&&!level[v])q.push(v),level[v]=level[u]+;
}
}
return ;
}
int dfs(int u,int maxf,int t){
if(u==t)return maxf;int rat=;
for(int i=head[u];~i&&rat<maxf;i=G[i].next){
int v=G[i].v,f=G[i].f;
if(f&&level[v]==level[u]+){
f=dfs(v,min(f,maxf-rat),t);
G[i].f-=f;G[i^].f+=f;rat+=f;
}
}
if(!rat)level[u]=inf;
return rat;
}
inline void dinic(){while(bfs(s,t))ans+=dfs(s,inf,t);}
inline int read(){
int f=,x=;char ch;
do{ch=getchar();if(ch=='-')f=-;}while(ch<''||ch>'');
do{x=x*+ch-'';ch=getchar();}while(ch>=''&&ch<='');
return f*x;
}
int main(){
s=;for(int i=;i<=N;i++)head[i]=-;
n=io.xuint();m=io.xuint();x=io.xuint();t=n;int u,v,w,f;
for(int i=;i<=m;i++){
u=io.xuint(),v=io.xuint(),f=io.xuint();
addedge(u,v,f);
}
dinic();
if(!ans)puts("Orz Ni Jinan Saint Cow!");
else printf("%d %d\n",ans,x/ans+(x%ans!=));
return ;
}
05-23 20:04