题目链接 题目大意:$n$个点, 每个点$i$有成功率$p_i$, 若成功走到$i+1$, 否则走到走到$i-1$, 多组询问, 求从$l$出发, 在$l$处不失败, 最后在$r$处胜利的概率 设$L[l,r]$表示从$l$出发, 在$l$处不失败, 最后在$r$处胜利的概率,$R[l,r]$表示从$r$出发, 在$l$处不失败, 最后在$r$处胜利的概率 记$l_1=L[l,mid],r_1=L[mid+1,r],l_2=R[l,mid],r_2=R[mid+1,r].$ 枚举在$mid$到$…
D. Legacy time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Rick and his co-workers have made a new radioactive formula and a lot of bad guys are after them. So Rick wants to give his legacy…
http://codeforces.com/problemset/problem/91/B B. Queue time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output There are n walruses standing in a queue in an airport. They are numbered startin…
I - Vasya and a Tree CodeForces - 1076E 其实参考完别人的思路,写完程序交上去,还是没理解啥意思..昨晚再仔细想了想.终于弄明白了(有可能不对 题意是有一棵树n个点,初始时候每个点权值都为0,m次修改,对v的叶子节点且距离小于d的都加上x 也就是v以下d层包括v自身都加上x 问最后每个点的权值 现在一想 用线段树来维护就是很自然的事了 但是要维护什么值呢 维护的就是某个深度上增加的值 先更新 后回溯取消更新 详见代码注释 #include <cstdio>…
题目链接 loj2537 题解 观察题目的式子似乎没有什么意义,我们考虑计算出每一种权值的概率 先离散化一下权值 显然可以设一个\(dp\),设\(f[i][j]\)表示\(i\)节点权值为\(j\)的概率 如果\(i\)是叶节点显然 如果\(i\)只有一个儿子直接继承即可 如果\(i\)有两个儿子,对于儿子\(x\),设另一个儿子为\(y\) 则有 \[f[i][j] += f[x][j](1 - p_i)\sum\limits_{k > j}f[r][k] + f[x][j]p_i\sum\…
D. Points time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follow…
线段树统计和维护某一区间内的字母个数.. . . F. TorCoder time limit per test 3 seconds memory limit per test 256 megabytes input input.txt output output.txt A boy named Leo doesn't miss a single TorCoder contest round. On the last TorCoder round number 100666 Leo stumbl…
Almost Regular Bracket Sequence CodeForces - 1095E You are given a bracket sequence ss consisting of nn opening '(' and closing ')' brackets. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expressio…
Sereja and Brackets 题目链接: CodeForces - 380C Sereja has a bracket sequence s1, s2, ..., *s**n, or, in other words, a string s* of length n, consisting of characters "(" and ")". Sereja needs to answer m queries, each of them is describe…
C. Glass Carving time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectan…