![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
文章平均质量分 71
yamiedie_
这个作者很懒,什么都没留下…
展开
-
CodeForces 643E Bear and Destroying Subtrees (概率)
#include #include #include #include #include #include using namespace std;#define N 500020#define T 66#define eps 1e-8int n;double dp[N][T];int fa[N], d[N];int main() { int q; scan原创 2016-07-18 13:59:23 · 502 阅读 · 0 评论 -
Codeforces 513G2 Inversions problem (dp)
#include #include #include #include #include #include using namespace std;#define N 220#define ls (i << 1)#define rs (ls | 1)#define md (ll + rr >> 1)#define lson ll, md, ls#define rson原创 2016-06-12 19:00:36 · 383 阅读 · 0 评论 -
Codeforces 187D BRT Contract (线段树)
#include #include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#def原创 2016-05-23 11:00:31 · 559 阅读 · 0 评论 -
Codeforces 452C Magic Trick (概率)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker, "/STACK:102400000,102400000")using namespace std;#define LL lon原创 2016-06-07 14:13:37 · 539 阅读 · 0 评论 -
Codeforces 235B Let's Play Osu! (概率)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker, "/STACK:102400000,102400000")using namespace std;#define LL lon原创 2016-06-07 13:57:12 · 420 阅读 · 0 评论 -
Codeforces 654F Paper task (sam+bit)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define eps 1e原创 2016-05-20 13:02:09 · 447 阅读 · 0 评论 -
Codeforces 666E Forensic Examination (sam+线段树合并)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define eps 1e原创 2016-05-20 12:20:23 · 799 阅读 · 0 评论 -
CodeForces 587E Duff as a Queen (线段树+线性基)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker, "/STACK:102400000,102400000")using namespace std;#define LL lon原创 2016-06-01 21:46:51 · 1185 阅读 · 0 评论 -
Codeforces 150E Freezing with Style (树分治)
#include #include #include #include using namespace std;#define N 100020#define M 200020#define inf 0x3f3f3f3fint fst[N], nxt[M], vv[M], cost[M], e;int n, m;int dep[N], fa[N], sz[N], cnt[原创 2016-05-29 22:19:47 · 994 阅读 · 0 评论 -
Codeforces 464E The Classic Problem (线段树+哈希)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define eps 1e原创 2016-05-28 16:36:18 · 772 阅读 · 0 评论 -
Codeforces 217E Alien DNA (树状数组求第k大)
#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define eps 1e原创 2016-05-28 12:50:28 · 532 阅读 · 0 评论 -
Codeforces 258D Little Elephant and Broken Sorting (逆序对,概率)
#include #include #include using namespace std;#define N 1020int a[N];double p[N][N];int n, m;int main() { scanf("%d%d", &n, &m); for(int i = 1; i <= n; ++i) scanf("%d", &a[i]); for(int原创 2016-06-13 13:49:29 · 700 阅读 · 0 评论 -
CodeForces 633E Startup Funding (概率)
#include #include #include #include #include #include #include using namespace std;#define N 2000030#define ls (i << 1)#define rs (ls | 1)#define md (ll + rr >> 1)#define lson ll, md, ls原创 2016-06-15 14:19:37 · 786 阅读 · 0 评论 -
CodeForces 175D Plane of Tanks: Duel (概率)
#include #include #include #include #include using namespace std;#define N 100020#define T 5030#define eps 1e-8int hp0, dt0, l0, r0;int hp1, dt1, l1, r1;double p0, p1;double f0[220], f原创 2016-07-17 17:53:31 · 416 阅读 · 0 评论 -
CodeForces 248E Piglet's Birthday (概率)
#include #include #include #include #include using namespace std;#define N 100020int n, a[N], aa[N];int c[N];long double p[N][120];long double C(int a, int b) { long double ret = 1;原创 2016-07-17 16:05:49 · 368 阅读 · 0 评论 -
CodeForces 605E Intergalaxy Trips (概率)
#include #include #include #include #include using namespace std;#define N 1020int n;double p[N][N];double m[N], A[N], B[N];bool vis[N];int dcmp(double x) { if(fabs(x) < 1e-12) return原创 2016-07-17 14:53:55 · 547 阅读 · 0 评论 -
CodeForces 113D Museum (高斯消元)
#include #include #include #include #include using namespace std;#define N 23vector g[N];int n, m, a, b;int d[N];double p[N];double A[N * N][N * N], X[N * N][N], B[N * N][N];int mp[原创 2016-07-17 13:22:46 · 775 阅读 · 0 评论 -
CodeForces 623D Birthday (贪心)
//// main.cpp// Main//// Created by czk on 16/7/13.// Copyright © 2016年 czk. All rights reserved.//#include #include #include using namespace std;#define N 120double p[N];int n;i原创 2016-07-17 13:21:51 · 396 阅读 · 0 评论 -
CodeForces 101D Castle (贪心)
#include #include #include #include #include #include using namespace std;#define N 400020#define M 200020int fst[N], nxt[M], vv[M], cost[M], e;void init() { memset(fst, -1, sizeof fs原创 2016-07-02 16:35:44 · 587 阅读 · 0 评论 -
CodeForces 464D World of Darkraft - 2 (概率)
#include #include #include #include #include #include using namespace std;#define N 100020#define B 800double dp[2][B];int n, k;int main() { scanf("%d%d", &n, &k); dp[0][1] = 0; for原创 2016-07-02 14:58:27 · 670 阅读 · 0 评论 -
CodeForces 24D Broken robot (三对角矩阵消元)
#include #include #include #include #include #include using namespace std;#define N 1020int n, m, x, y;double dp[N][N];void ele(double x[], double a[], double b[], double c[], double r原创 2016-07-01 15:45:03 · 604 阅读 · 0 评论 -
CodeForces 494C Helping People (treedp)
#include #include #include #include #include #include using namespace std;#define N 100020int n, q;int a[N];int L[N], R[N];double p[N];int ord[N];int stk[N], top;vector adj[N];int原创 2016-07-01 15:43:47 · 492 阅读 · 0 评论 -
CodeForces 364D Ghd (随机)
#include #include #include #include #include #include using namespace std;#define N 1000020#define LL long longint n;LL a[N], b[N];LL ans;LL san[N];int cnt, c[N], d[N];set s;LL gc原创 2016-06-15 15:50:18 · 982 阅读 · 0 评论 -
Codeforces 319E Ping-Pong (线段树+dsu)
#include #include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#def原创 2016-05-24 15:44:37 · 815 阅读 · 0 评论 -
Codeforces 249D Donkey and Stars (线段树+扫描线)
#include #include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#def原创 2016-05-24 10:30:38 · 639 阅读 · 0 评论 -
Codeforces 217D Bitonix' Patrol (dfs + bitset)
#include using namespace std;#define N 122#define mod 1000000007bool vis[N];int cnt[N], x[N];int n, m, k;bitset s[8];int ans;int getAns(int d) { int ret = 1; for(int i = 1; i < d; ++i)原创 2016-04-01 15:25:07 · 513 阅读 · 0 评论 -
Codeforces 135E Weak Subsequence(组合计数)
#include #include #include using namespace std;#define N 1000030#define mod 1000000007int qpow(int x, int k) { int ret = 1; while(k) { if(k & 1) ret = 1LL * ret * x % mod; k >>= 1; x原创 2016-04-01 13:42:51 · 461 阅读 · 0 评论 -
Codeforces 659G Fence Divercity (组合计数)
#include #include #include #include #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f#define N 1000020#define M 1000020#define原创 2016-03-31 15:43:16 · 621 阅读 · 0 评论 -
Codeforces 145D Lucky Pair (组合计数)
#include #include #include #include #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f#define N 1000020#define M 1000020#define原创 2016-03-31 14:55:33 · 633 阅读 · 0 评论 -
Codeforces 472G Design Tutorial: Increase the Constraints(分块+FFT)
#include #include #include #include using namespace std;#define N 550020#define LL long long#define MOD 1000000007#define K 3#define G 3const int B = 6000;int n, m;char s[N], t[N];in原创 2016-03-15 20:20:19 · 588 阅读 · 0 评论 -
Codeforces 623E Transforming Sequence (分治+FFT)
#include #include #include #include using namespace std;#define N 200020#define LL long long#define MOD 1000000007#define K 3#define G 3// 1000000000000000000 30000int m[] = {1004535809,原创 2016-03-15 20:22:03 · 1028 阅读 · 0 评论 -
Codeforces 300D Painting Square (FFT)
#include #include #include #include #include #include #include #include #include #include using namespace std;using namespace std::tr1;#define N 60020#define LL long long#define ls (i原创 2016-03-15 20:25:29 · 841 阅读 · 0 评论 -
Codeforces Round #296 (Div. 1)
A. Glass Carving题意:给定一个w*h的矩形, 每次水平或者竖直地切, 问每次切完之后矩形之中最大的块的面积是多少。思路:分开考虑竖直方向和水平方向, 因为每次切完之后都是取两个方向的块的最大值。对于竖直方向, 如果逆序地考虑操作, 那么每次操作之后相当于是把两块分开的块连起来, 那么如果更新最大值的话,只需要把最大值和这两块的长度对比就行。然后记录块的大小的原创 2015-03-18 22:39:33 · 463 阅读 · 0 评论 -
Codeforces Round #295 (Div. 1)
A. DNA Alignment题意: 给定一个字符串s。 ……&(&(%……*&……)&*(&(*&%…………*%#%¥@¥*(%()思路: 假设s和t中AGCT的出现次数为a,b,c,d和w,x,y,z次, 则h(s,t) = n * (a * w + b * x + c * y + d * z)。所以, 如果n和abcd都是一定的话, 那么t中的字符一定要取出现次数最大的那个字符原创 2015-03-02 21:28:16 · 467 阅读 · 0 评论 -
Codeforces Round #294 (Div. 2)
D. A and B and Interesting Substrings题意:给定26个小写字母的权值和一个字符串, 求出该字符串有多少个连续的子串,首尾相同, 并且除了首尾权值和为0。思路:权值和为0说明子串的两个端点的前缀和相同, 先预处理出前缀和, 然后因为首尾要相同, 所以开26个map记录一个某个字符的前缀和的出现次数。#include #include #includ原创 2015-03-01 09:37:02 · 419 阅读 · 0 评论 -
Codeforces 44I Toys (构造)
#include using namespace std;#define N 122#define mod 1000000007#define vvi vector >#define vi vector#define pb push_backint n;int p[N];bool vis[12];void output(vi &s) { memset(vis, 0,原创 2016-04-01 16:39:37 · 380 阅读 · 0 评论 -
Codeforces 283B Distinct Paths (dfs+剪枝)
#include #include #include #include #include #include using namespace std;#define N 20#define M 400030#define mod 1000000007#define B 234324#define LL long longint n, m, k;int a[N][N];原创 2016-03-22 22:35:38 · 480 阅读 · 0 评论 -
Codeforces 396D On Sum of Number of Inversions in Permutations (逆序对计数)
#include #include #include #include #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f#define N 1000020#define M 1000020#define原创 2016-03-25 13:21:12 · 706 阅读 · 0 评论 -
Codeforces 585E Present for Vitalik the Philatelist (莫比乌斯反演)
#include #include #include #include #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f#define N 10000020#define M 1000020#define原创 2016-03-24 18:32:53 · 571 阅读 · 0 评论 -
Codeforces 235E Number Challenge (莫比乌斯反演)
#include #include #include #include #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f#define N 4000020#define M 1000020#define原创 2016-03-24 15:53:36 · 425 阅读 · 0 评论