正解:网络流+二分
解题报告:
其实我第一反应是费用流来着,,,但是仔细想了下发现我不会实现各个武器之间独立同时?而且攻击是连续的答案可能是小数嘛$QwQ$.
所以显然不是递推就二分呗$QwQ$.然后依然是因为小数的约束,所以最后选择的二分$QwQ$
$umm$然后就傻逼题了呗?
$check$的话直接武器建一排点机器人建一排点,$S$和武器$i$连$B_{i}\cdot time$,机器人$j$和$T$连$A_{i}$,然后武器和能攻击的机器人之间连$inf$,欧克做完辣!
$over$,感觉也没什么要注意的细节,那就放下代码就成$QwQ$
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define lf double
#define gc getchar()
#define t(i) edge[i].to
#define n(i) edge[i].nxt
#define w(i) edge[i].wei
#define ri register int
#define rb register bool
#define rc register char
#define rp(i,x,y) for(ri i=x;i<=y;++i)
#define e(i,x) for(ri i=head[x];~i;i=n(i)) const int N=+,M=;
const lf eps=1e-,inf=1e9;
int S,T,ed_cnt=-,head[N],cur[N],a[N],b[N],dep[N],m,n;
bool d[M][M];
lf l,r=1e6,sum;
struct ed{int to,nxt;lf wei;}edge[N<<]; il int read()
{
rc ch=gc;ri x=;rb y=;
while(ch!='-' && (ch>'' || ch<''))ch=gc;
if(ch=='-')ch=gc,y=;
while(ch>='' && ch<='')x=(x<<)+(x<<)+(ch^''),ch=gc;
return y?x:-x;
}
il void ad(ri x,ri y,lf z)
{edge[++ed_cnt]=(ed){x,head[y],z};head[y]=ed_cnt;edge[++ed_cnt]=(ed){y,head[x],(lf)};head[x]=ed_cnt;}
il bool bfs()
{
queue<int>Q;Q.push(S);memset(dep,,sizeof(dep));dep[S]=;
while(!Q.empty()){ri nw=Q.front();Q.pop();e(i,nw)if(w(i)-eps> && !dep[t(i)])dep[t(i)]=dep[nw]+,Q.push(t(i));}
return dep[T];
}
il lf dfs(ri nw,lf flow)
{
if(nw==T || !flow)return flow;lf ret=;
for(ri &i=cur[nw];~i;i=n(i))
if(w(i) && dep[t(i)]==dep[nw]+)
{lf tmp=dfs(t(i),min(flow,w(i)));ret+=tmp,w(i)-=tmp;w(i^)+=tmp,flow-=tmp;}
return ret;
}
il lf dinic(){lf ret=;while(bfs()){rp(i,S,T)cur[i]=head[i];while(lf d=dfs(S,inf))ret+=d;}return ret;}
il bool check(lf tim)
{
ed_cnt=-;memset(head,-,sizeof(head));
rp(i,,m)rp(j,,n)if(d[i][j])ad(j+m,i,inf);
rp(i,,n)ad(T,i+m,a[i]);rp(i,,m)ad(i,S,b[i]*tim);
//printf("dinic=%.6lf sum=%.1lf\n",dinic(),sum);
return dinic()<sum;
} int main()
{
//freopen("3324.in","r",stdin);freopen("3324.out","w",stdout);
n=read();m=read();S=;T=n+m+;rp(i,,n)sum+=a[i]=read();rp(i,,m)b[i]=read();rp(i,,m)rp(j,,n)d[i][j]=read();
while(r-l>eps){lf mid=(l+r)/;if(check(mid))l=mid;else r=mid;}printf("%.6lf\n",r);
//printf("%d",check(82));
//check(82);
return ;
}