- 博客(1485)
- 资源 (3)
- 收藏
- 关注
原创 Codeforces 237E Build String 【费用流】
题目链接:Codeforces 237E Build StringE. Build String time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You desperately need to build some str
2016-08-11 20:29:32 755
原创 Codeforces Round #365 (Div. 2)
懒得吐槽了。 A 水的不能再水了。 B 题意:n个成环的点,有k个特殊点和其它每个点都有一条边。已知任意两个点之间最多1条边,边权是这两个点权值乘积。 分别处理特殊点和非特殊点统计一下就好了。#include #include #include #include #include #include #include #include #include #incl
2016-08-05 15:19:14 422
原创 Educational Codeforces Round 15
A 题意:最长的连续LIS。 dp 跑一发即可#include <cstdio>#include <algorithm>#include <cmath>#include <vector>#include <cstring>#include <queue>#include <map>#include <set>#include <string>#define CLR(a, b)
2016-08-01 00:11:29 469
原创 2015 Multi-University Training Contest 3
A 定义一个合法序列:元素下标奇、偶相间。 题意:给定n个元素,有两个操作——修改第i个元素;查询区间[L, R]合法序列的最大和。 思路:线段树区间合并啦,不过返回结构体好使。#include #include #include #include #include #include #include #include #include #define CLR(a, b
2016-07-31 16:37:58 317
原创 Codeforces Round #364 (Div. 2)
A 题意: n个数,两两配对,要求配对后的和相等。保证存在方案。#include #include #include #include #include #include #include #include #include #define CLR(a, b) memset(a, (b), sizeof(a))#define ll o#define rr ousing
2016-07-31 16:37:19 433
原创 2016 Multi-University Training Contest 4
天天不知道忙些什么,懒得博客都不贴了。 A 题意:给定两个串aaa和bbb,你可以选择在串aaa中把与bbb相同的子串替换成∗∗*。问你可以得到多少种不同的新串。 思路:先kmpkmpkmp,记录所有与bbb相等的子串的区间[l,r][l,r][l, r],然后做dpdpdp。 dp[i][0]dp[i][0]dp[i][0]表示处理前i个且第i个区间不选用。 dp[i][1]dp[i]...
2016-07-31 15:24:19 596
原创 BestCoder Round #85
好久没打BC了,hack数据怎么输来着。。。真心手速和思维慢了好多。A#include #include #include #include #include #include #include using namespace std;typedef long long LL;const int MAXN = 1e5 + 1;int a[MAXN], p[MAXN]
2016-07-30 22:22:31 494
原创 poj 3295 Tautology && poj 1035 Spell checker 【字典树】
各种不顺,G++ %lf卡我那么多次,一个水BFS卡我好长时间以及那道不用字典树都可以过的SB题。。。日狗了。 poj 3295 Tautology判断给定的WFF式子是否永真。正着逆波兰想太简单会出bug,直接倒着跑一遍就搞定了。zz#include #include #include #include #include #include #include #incl
2016-07-27 18:23:53 441
原创 2016 Multi-University Training Contest 3
先扔这以后再补吧,神马比赛都是浮云。。。 A 题意:就是问n能否开k次根号得到1,其中k #include #include #include #include #include #include #include #define CLR(a, b) memset(a, (b), sizeof(a))#define ll o#define rr ousing names
2016-07-26 19:13:20 354
原创 2015 Multi-University Training Contest 1
感觉题目很棒,贴上留作记录。 A 定义 f(L, R)为区间[L, R]里面合法数的个数。一个数a[i]合法意味着L 题意:问你所有区间合法数的总数。 思路:一开始一直YYO(n)的神算法,发现实在不可搞,最后直接暴力找每个数的最近因子区间就过了。#include #include #include #include #include using namespace st
2016-07-26 19:13:02 308
原创 hdoj 3333 Turing Tree 【树状数组】
题目链接:hdoj 3333 Turing TreeTuring TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4408 Accepted Submission(s): 1533Problem Descrip
2016-07-20 17:03:27 793
原创 Codeforces Round #363 (Div. 2)
A 最近的RL之间距离的一半。#include #include #include #include #include #include #include #define CLR(a, b) memset(a, (b), sizeof(a))using namespace std;typedef long long LL;const int MAXN = 1e5 +
2016-07-20 12:34:26 295
原创 Codeforces Round #360 (Div. 2)
A 最大连续的存在0字符子串个数。#include #include #include using namespace std;int main(){ int n, d; while(scanf("%d%d", &n, &d) != EOF) { int l = 0, ans = 0; for(int i = 0; i < d;
2016-07-20 12:34:05 350
原创 Codeforces Round #358 (Div. 2)
A 题意:从区间[1, n]任取一个数x,从区间[1, m]任取一个数y。问你有多少对(x, y)满足(x + y) % 5 == 0。思路:5个一循环。#include #include #include #include #include #include #include #include #include #include #include #include
2016-06-18 11:07:45 478 2
原创 Codeforces 679B Bear and Tower of Cubes 【贪心】
题目链接:Codeforces 679B Bear and Tower of CubesB. Bear and Tower of Cubes time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Limak is a littl
2016-06-18 11:07:00 1148
原创 Codeforces 671B Robin Hood 【思维】
题目链接:Codeforces 671B Robin HoodB. Robin Hood time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output We all know the impressive story of Robin H
2016-06-16 22:35:58 1770
原创 Codeforces 671A Recycling Bottles 【dp】
题目链接:Codeforces 672C Recycling BottlesC. Recycling Bottles time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output It was recycling day in Keko
2016-06-16 22:35:16 433
原创 Codeforces E. Qwerty78 Trip 【组合数学】
题目链接:E. Qwerty78 Trip n*m的格子,其中有一个格子是坏的,问你从(1, 1) - (n, m)有多少种走法。填满n * m的矩阵,发现这就是一个杨辉三角的组合数问题。 在格子没有坏的情况下,(1, 1) - (n, m)的走法dp[1][1][n][m] = C(n+m-2, m-1)。 当(x, y)坏的情况下,少出的情况就是dp[1][1][x][y] * dp[x]
2016-05-31 14:32:40 666
原创 2016 百度之星 初赛A
A:hdoj 5690 All X 打个表看了看,发现循环最大不超过k,因为k最大为10000,就先暴力找一下,最多找k次。我们边找边记录结果,若发现相同的就说明找到一个循环节,直接跳出即可。 AC代码:#include <cstdio>#include <cstring>#include <cmath>#include <map>#include <set>#include <ios
2016-05-21 18:20:22 1257 2
原创 Codeforces 675C Money Transfers 【思维】 + 675D Tree Construction 【二分】
题目链接:Codeforces 675C Money TransfersC. Money Transfers time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There are n banks in the city where
2016-05-19 14:12:21 836
原创 HZAUoj 1015: LCS 【LCS变形】 + 1016: Array C 【贪心】
真是SB,20多个人花了6个小时顶着太阳去爬山,结果还没到顶,真心不如在机房打代码。题目链接:HZAUoj 1015: LCS 题意:给定两个字符串a和b,让你找它们特殊的LCS——该LCS在a、b原串中任一连续段长度不小于k。问你最长的LCS。 思路:考虑dpdp 设置End[i][j]End[i][j]表示以a[i]、b[j]结尾的串的最大连续段长度。 设置dp[i][j]dp[i][j
2016-05-16 20:58:27 633
原创 2016 百度之星 资格赛
A 没想太多,设个逆元就过了。B 斐波那契数列高精度。n == 0时输出换行。。。C 字典树,记录结点的单词数 以及 当前结点是否是单词的末尾,delete时需要先找出前缀对应的串数,统计末尾结点总数,然后用前缀减掉就好了。一开始DFS跑的时候没有把delete的结点去掉(SB啊),但强行951ms过了,后来做完没事改了改跑了
2016-05-14 17:09:08 543
原创 uva 4259 - Dangerous Tunnels 【二分 + 最大流】
题目链接:uva 4259 - Dangerous TunnelsSomewhere in the world, there are two tribes separated by mountains. The two tribes are named Kulolo and Gulolo, respectively, where Kulolo is at a higher altitude a
2016-05-14 16:47:10 445
原创 uva 4260 - Fortune Card Game 【dp】
题目链接:uva 4260 - Fortune Card GameA popular card game called fortune" is getting popular in country X. Fig. 1 shows one of the cards. In each card, a positive integer number (20 in the figure) is lis
2016-05-14 16:46:23 370
原创 Codeforces 667C Reberland Linguistics 【dp】
题目链接:Codeforces 667C Reberland LinguisticsC. Reberland Linguistics time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output First-rate specialist
2016-05-14 16:45:42 881
原创 Codeforces 141C Queue 【构造】
题目链接:Codeforces 141C QueueC. Queue time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output In the Main Berland Bank n people stand in a queue at t
2016-05-12 18:24:09 500
原创 CDOJ 1041 Hug the princess 【思维】
题目链接:CDOJ 1041 Hug the princess题意:求解∑ni=1\sum_{i=1}^n a[i] ^ a[j] + a[i] | a[j] + a[i] & a[j]。思路:a ^ b + a | b + a & b = a + b + a | b - a & b。先统计a + b的贡献,而a | b + a & b的贡献则是每个二进制位上1的个数,最后累加一下就好了。
2016-05-10 20:51:23 389
原创 fzoj Problem 1894 志愿者选拔 【单调队列】
题目链接:fzoj Problem 1894 志愿者选拔Problem 1894 志愿者选拔 Accept: 1781 Submit: 5555 Time Limit: 1500 mSec Memory Limit : 32768 KB Problem Description世博会马上就要开幕了,福州大学组织了一次志愿者选拔活动。参加志愿者选拔的同学们排队接受面试
2016-05-10 20:50:57 815
原创 Codeforces 165E Compatible Numbers 【dp】
题目链接:Codeforces 165E Compatible NumbersE. Compatible Numbers time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Two integers x and y are c
2016-05-07 14:56:21 1158
原创 Codeforces 165D Beard Graph 【树链剖分】
题目链接:Codeforces 165D Beard GraphD. Beard Graph time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Let’s define a non-oriented connected gr
2016-05-07 14:52:03 860
原创 Codeforces 165C Another Problem on Strings 【二分】
题目链接:Codeforces 165C Another Problem on StringsC. Another Problem on Strings time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output A string i
2016-05-07 14:51:29 1191
原创 Codeforces 165B Burning Midnight Oil 【二分】
题目链接:Codeforces 165B Burning Midnight OilB. Burning Midnight Oil time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One day a highly importan
2016-05-07 14:51:07 874
原创 hdoj 3415 Max Sum of Max-K-sub-sequence 【单调队列】
题目链接:hdoj 3415 Max Sum of Max-K-sub-sequenceMax Sum of Max-K-sub-sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6975 Accepted
2016-05-07 14:50:14 855
原创 fzoj Problem 2233 ~APTX4869 【并查集】
题目链接:fzoj Problem 2233 ~APTX4869Problem 2233 ~APTX4869 Accept: 15 Submit: 37 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description 为了帮助柯南回到一米七四,阿笠博士夜以继日地研究APTX4869的解药。他得出了如下结果:1
2016-05-03 22:45:51 759
原创 hdoj 2870 Largest Submatrix 【单调栈】
题目链接:hdoj 2870 Largest SubmatrixLargest SubmatrixTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2108 Accepted Submission(s): 1013Problem De
2016-05-03 14:52:56 502
原创 fzoj Problem 2190 非提的救赎 【单调栈】
题目链接:fzoj Problem 2190 非提的救赎Problem 2190 非提的救赎 Accept: 106 Submit: 312 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description 正如你所知道从前有一个人叫s_sin,她拥有着坐拥三千舰狼的梦想!然而天不遂人愿当她踏进henta
2016-05-02 21:52:59 538
原创 hdoj 1074 Doing Homework 【状压dp】
题目链接:hdoj 1074 Doing HomeworkDoing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7491 Accepted Submission(s): 3346Problem D
2016-05-02 21:52:35 426
原创 hdoj 1505 City Game 【dp or 单调栈】
题目链接:hdoj 1505 City GameCity GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6223 Accepted Submission(s): 2657Problem Description
2016-05-02 21:52:03 473
原创 hdoj 1506 Largest Rectangle in a Histogram 【单调栈】
题目链接:hdoj 1506 Largest Rectangle in a HistogramLargest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15601 Ac
2016-05-02 21:51:36 411
原创 Poj 3250 Bad Hair Day 【单调栈】
题目链接:Poj 3250 Bad Hair DayBad Hair Day Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16700 Accepted: 5621 DescriptionSome of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having
2016-05-02 21:51:02 492
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人