[cf113d]Museum】的更多相关文章

题意 题目链接 Sol 设\(f[i][j]\)表示Petya在\(i\),\(Vasya\)在\(j\)的概率,我们要求的是\(f[i][i]\) 直接列方程高斯消元即可,由于每个状态有两维,因此时间复杂度为\(O(n^6)\) 注意不能从终止节点转移而来 #include<bits/stdc++.h> using namespace std; const int MAXN = 2333; inline int read() { char c = getchar(); int x = 0,…
传送门 Solution 设一个状态为 \((x,y)\) 表示两人在的位置,求出每个状态期望出现的次数 设一个状态为 \(u\) , \(x_u^0=[u==(a,b)]\) 所以一个状态出现的次数期望为 \(E_u=x_u^0+\sum_vG(v,u)\times E_v\) 其中\(G\)是状态转移的概率矩阵 高消即可,复杂度 \(O(n^6)\) Code  #include<bits/stdc++.h> #define ll long long #define db double #…
Portal --> cf113D Solution 额题意的话大概就是给一个无向图然后两个人给两个出发点,每个点每分钟有\(p[i]\)的概率停留,问这两个人在每个点相遇的概率是多少 如果说我们知道最后在哪里相遇,处理起来会比较方便.注意到\(n\)比较小,所以考虑枚举最后相遇的房间,然后可以看成求两个人同时从最后相遇的房间出发,走到\(X\)和\(Y\)的概率,这样初始状态什么的比较好表示,就会好求很多了(跟..hnoi2013游走有点像?) 考虑\(dp\) ,假设我们现在枚举到终点是\(…
Upd 2021.10.21 更改了状态定义. 记 \(S(u)\) 表示 \(u\) 结点的相邻结点的集合. 又记 \(p(u)\) 表示走到了 \(u\) 且下一步继续留在 \(u\) 结点的概率,那么下一步离开 \(u\) 结点的概率即为 \(1 - p(u)\). 设 \(f(i, j)\) 表示 Petya 在 \(i\) 且 Vasya 在 \(j\) 这种状态的期望出现次数. 可知所有的形如 \(f(i, i)\) 的状态都是不能用于转移的,因为它们已经是末状态了. 因为钦定了末状…
Sackler Museum of Art and Archaeology at Peking University is located on a beautiful site near the West Gate of Peking University campus, and its architecture takes the inspiration from buildings that already exist on campus. The collection of Chines…
D. Igor In the Museum Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/D Description Igor is in the museum and he wants to see as many pictures as possible. Museum can be represented as a rectangular field of n ×…
D. Igor In the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Igor is in the museum and he wants to see as many pictures as possible. Museum can be represented as a rectangular fiel…
A. Night at the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night…
D. Museum time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The muse…
A. Night at the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night…