有趣的水題
由期望的線性性質,全域性期望 = 每個格仔的期望之和
由於權值一樣,我們優先選概率大的點就好了
用一些資料結構來維護就好了
複雜度$o(k \log n)$
#include #include#include
#include
#include
#include
#include
#include
namespace
remoon
while(c >= '
0' && c <= '
9') p = p * 10 + c - '
0', c =gc();
return p *w;
}int wr[50
], rw;
#define pc(iw) putchar(iw)tpr inline
void write(ra o, char c = '\n'
) tpr inline
void cmin(ra &a, ra b)
tpr inline
void cmax(ra &a, ra b)
tpr inline
bool ckmin(ra &a, ra b)
tpr inline
bool ckmax(ra &a, ra b)
}using
namespace
std;
using
namespace
remoon;
namespace
mod_mod
inline
void dec(int &a, int b)
inline
int inc(int a, int b)
inline
int dec(int a, int b)
inline
int mul(int a, int b)
}using
namespace
mod_mod;
de ans = 0
;int
n, m, r, k;
int nx[10] = ;
int ny[10] = ;
struct
node
};priority_queue
q;map
int>vis;
inline
bool ck(int x, int
y) inline ll solve(
int x, int
y) int
main() );
while(k --) );}}
}printf(
"%.9lf\n
", ans);
return0;
}