hdu 6299 Balanced Sequence Balanced SequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 973 Accepted Submission(s): 218 Problem DescriptionChiaki has n stri...
牛客练习赛45 A QAQ:dp[i][0]表示前i个字符可以组成的"Q",dp[i][1]表示前i个字符可以组成的"QA",dp[i][2]表示前i个字符可以组成的"QAQ"。扫一遍即可。#include<bits/stdc++.h>using namespace std;#define ll long longconst int maxn=1e5+10;char t[5005]...
Wannafly挑战赛1 C:MMSet2 题面最优的点一定在给定点集中最远的两点的简单路径上。#include<bits/stdc++.h>using namespace std;const int maxn=3e5+10;int head[maxn],To[maxn*2],Next[maxn*2],tol;void add_edge(int x,int y){ To[tol]=y; Nex...
Codeforces Round #549 (Div. 1) B. Lynyrd Skynyrd(倍增) 题面按照贪心策略,枚举以每个位置为结尾,则往前遍历,找到它的前一个数字最近的出现位置,然后往前跳n-1步,倍增判断一下跳到了哪个点。然后线段树查询一下区间最大值即可。#include<bits/stdc++.h>using namespace std;const int maxn=2e5+10;vector<int>G[maxn];int n,m,Q,...
牛客挑战赛30 C-小G砍树(换根) 题面先考虑1号店最后移除时候的贡献,我们可以钦定1号点为根,并钦定他最后移除然后就是一个树形dp设fifi表示i号点子树移除方案数量,sizeisizei表示1为根时子树大小显然有dp式子fx=(sizex−1)!∏(sizei)!∏fifx=(sizex−1)!∏(sizei)!∏fi(满足1为根时x是i的爹)然后最后移除点1的情况的贡献就算出来了我们考虑换根先考虑...
BZOJ 4423: [AMPPZ2013]Bytehattan(对偶图+并查集维护连通性) 题面/*转成对偶图,若删这条边之前此边对应对偶图中的两个点已经联通,则对偶图中这两点在连一条边就形成了一个割,所以删除这条边两点不连通。*/#include<bits/stdc++.h>using namespace std;const int maxn=3e6+10;int par[maxn],n,k;int Find(int x){ if(x==pa...
hdu 6184 Counting Stars(三元环计数) 题目链接题解链接#include<bits/stdc++.h>using namespace std;const int maxn=2e5+10;int n,m,from[maxn],to[maxn];vector<int>G[maxn],s[maxn];int in[maxn],re[maxn],rev[maxn],val[maxn];int mai...
hdu 6191 Query on A Tree(字典树+启发式合并) 题目链接每个节点建一颗字典树,启发式合并就好了。内存n*logn*logn,内存超限,考虑合并完之后废弃的字典树的节点存一下,后面再次利用。#include<bits/stdc++.h>using namespace std;#define ll long longconst int maxn=1e5+10;int tree[maxn*55][2],a[maxn]...
hihoCoder #1048 : 状态压缩·二 链接:http://hihocoder.com/problemset/problem/1048题解:https://blog.csdn.net/my_sunshine26/article/details/74612684#include<bits/stdc++.h>using namespace std;const int mod=1000000007;int dp[1...
Codeforces Round #519 by Botan Investments 题目:http://codeforces.com/contest/1043A. Elections枚举k的值#include<bits/stdc++.h>using namespace std;int n,a[105];int work(){ int sum=0,ma=0; for(int i=1;i<=n;i++) sum+...
BZOJ 1013: [JSOI2008]球形空间产生器sphere(高斯消元) 题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1013思路:存在二次项,考虑两式相减可以把所有未知数的二次项消掉,n+1 个等式用第一个与后面的做差,形成n个不等式,然后高斯消元即可。代码:#include<cstdio>#include<cmath>#include<algorithm...
BZOJ 2648: SJY摆棋子(kd tree) 题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2648#include<bits/stdc++.h>using namespace std;const int inf = 0x3f3f3f3f;const int maxn=1e6+100;int idx,n,m,tol,ans;struct node{ ...
hdu 4347 The Closest M Points (kd tree 模板题) 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4347#include<bits/stdc++.h>using namespace std;#define sq(x) (x)*(x)const int maxn=6e4+10;int idx,n,k,m,lson[maxn],rson[maxn],tol;struct node...
codeforces 1040E. Network Safety 题目:http://codeforces.com/contest/1040/problem/E思路:若x,y之间有一条边,权值分别为a[x],a[y], 设t=a[x]^a[y],则只有a[x]^t==a[y],a[y]^t==a[x],因此只有其中一个数异或上t才是不安全的,两个数都异或上t则相当于交换x,y。可以按0~(1<<k)-1逐个考虑每个x,若x==t时...
codeforces 1037F. Maximum Reduction(启发式合并) 题目:http://codeforces.com/contest/1037/problem/F思路:找出最大的一个点(值相同时取左边的点),计算以此点为最大值能够形成多少个合法的区间,然后处理该点左右两个区间,一直递归下去。假设以i为左端点,合法的右端点有i+(k-1),i+2*(k-1),i+3*(k-1),i+4*(k-1)i+t*(k-1)不能超过区间的范围。#includ...
2017 CCPP 秦皇岛 题目:链接A - Balloon Robot设机器人从0位置出发, 对于每一个a[i],b[i]算出b[i]时间机器人与s[a[i]]的距离,即所需等待时间,此时如果将机器人位置向前推进1,则它越过的t[i]时间都会加上m,因为要相遇就要多走一圈,然后所有的等待时间-1。代码:#include<bits/stdc++.h>using namespace st...
2018 icpc 南京网络赛 题目:链接A. An Olympian Math Problem输出n-1即可(女朋友猜的)。#include<bits/stdc++.h>using namespace std;#define ll long longll fac[103];int main(){ ll n,T;cin>>T; while(T--) { ...
2017 icpc 沈阳现场赛 题目:链接F Heron and His Triangle:暴力跑了几发,把搞出来的数扔进oeis里发现对于条件成立的t数组有t[i]=4*t[i-1]-t[i-2]。因此找到第一个大于等于N的t[i]就好了。但是数值范围超过了long long,因此要用大数,这样一个个找过去会超时,可以先对询问排序,这样下次的询问就可以接着上次的位置寻找。代码:#include...
2017 icpc 沈阳网络赛 题目:链接B cable cable cable:观察得,答案为K*(M-K+1)#include<bits/stdc++.h>using namespace std;#define ll long longint main(){ ll M,K; while(~scanf("%lld%lld",&M,&K)) pri...
2017 CCPC 杭州赛区 题面:http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdfProblem A. Super-palindrome:每个奇数长度的子串都是回文,有两种情况:1. aaaaaaa 都是相同字符2.ababababab 两个不同的字符一直交替。枚举每两个字符即可。代码:#include<bit...
codeforce 1027 F. Session in BSU F. Session in BSUtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp studies in Berland State University. Soon he will have...
BZOJ 4568: [Scoi2016]幸运数字(lca+线性基) 4568: [Scoi2016]幸运数字Time Limit: 60 Sec Memory Limit: 256 MBSubmit: 2256 Solved: 921[Submit][Status][Discuss]DescriptionA 国共有 n 座城市,这些城市由 n-1 条道路相连,使得任意两座城市可以互达,且路径唯一。每座城市都有一个幸运数字,以纪念碑的形式矗立...
BZOJ 2460: [BeiJing2011]元素(线性基) 2460: [BeiJing2011]元素Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 2412 Solved: 1250[Submit][Status][Discuss]Description 相传,在远古时期,位于西方大陆的 Magic Land 上,人们已经掌握了用魔法矿石炼制法杖的技术。那时人们就认识到,一个法杖的法力...
hdu 3949 XOR(线性基) XORTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4619 Accepted Submission(s): 1612 Problem DescriptionXOR is a kind of bit operator...
BZOJ 3110: [Zjoi2013]K大数查询(整体二分) 3110: [Zjoi2013]K大数查询Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 11673 Solved: 3512[Submit][Status][Discuss]Description有N个位置,M个操作。操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c如果是2 a b...
洛谷 P1306 斐波那契公约数 对于Fibonacci数列:1,1,2,3,5,8,13......大家应该很熟悉吧~~~但是现在有一个很“简单”问题:第n项和第m项的最大公约数是多少?Update:加入了一组数据。输入输出格式输入格式: 两个正整数n和m。(n,m<=10^9)注意:数据很大 输出格式: Fn和Fm的最大公约数。由于看了大数字就头晕,所以只要输出最后的8位数字就...
codeforce 1017 F. The Neutral Zone F. The Neutral Zonetime limit per test5 secondsmemory limit per test16 megabytesinputstandard inputoutputstandard outputNotice: unusual memory limit!After the war, destroyed cities...
POJ 2104 K-th Number(整体二分) K-th NumberTime Limit: 20000MS Memory Limit: 65536K Total Submissions: 67933 Accepted: 23979 Case Time Limit: 2000MS DescriptionYou are working for Macrohard company in data ...
BZOJ 4372: 烁烁的游戏(动态点分治) 4372: 烁烁的游戏Time Limit: 30 Sec Memory Limit: 512 MBSubmit: 804 Solved: 288[Submit][Status][Discuss]Description背景:烁烁很喜欢爬树,这吓坏了树上的皮皮鼠。题意:给定一颗n个节点的树,边权均为1,初始树上没有皮皮鼠。烁烁他每次会跳到一个节点u,把周围与他距离不超过d的...
BZOJ 3730: 震波(动态点分治) 3730: 震波Time Limit: 15 Sec Memory Limit: 256 MBSubmit: 3441 Solved: 611[Submit][Status][Discuss]Description在一片土地上有N个城市,通过N-1条无向边互相连接,形成一棵树的结构,相邻两个城市的距离为1,其中第i个城市的价值为value[i]。不幸的是,这片土地常常发生地震...
BZOJ 1095: [ZJOI2007]Hide 捉迷藏(动态点分治) 1095: [ZJOI2007]Hide 捉迷藏Time Limit: 40 Sec Memory Limit: 256 MBSubmit: 5415 Solved: 2276[Submit][Status][Discuss]Description 捉迷藏 Jiajia和Wind是一对恩爱的夫妻,并且他们有很多孩子。某天,Jiajia、Wind和孩子们决定在家里玩捉迷藏游戏...
hdu 6356 Glad You Came(倍增) Glad You CameTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 777 Accepted Submission(s): 269 Problem DescriptionSteve has an integ...
hdu 5909 Tree Cutting(树形dp+树上点分治) Tree CuttingTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 1291 Accepted Submission(s): 498 Problem DescriptionByteasar has a tree...
hdu 6336 Problem E. Matrix from Arrays Problem E. Matrix from ArraysTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1286 Accepted Submission(s): 583 Problem DescriptionKa...
hdu 6341 Problem J. Let Sudoku Rotate(数独) 题目:http://acm.hdu.edu.cn/showproblem.php?pid=6341思路:预处理每一个4*4 格子旋转的四种状态。然后dfs即可,时间上限4^(16) 但是实际上数独限制较多,大多数情况中途已经剪掉。代码: #include<bits/stdc++.h>using namespace std;char txt[20][20];in...
hdu 4812 D Tree(树上点分治) D TreeTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 6331 Accepted Submission(s): 1347 Problem DescriptionThere is a skyscraping ...
hdu 5977 Garden of Eden(树上点分治) Garden of EdenTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1844 Accepted Submission(s): 602 Problem DescriptionWhen God made th...
SPOJ COT - Count on a tree(LCA+主席树) COT - Count on a tree#tree You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight.We will ask you to perform the following operation:u v ...
HDU 6333 Problem B. Harvest of Apples(莫对算法) Problem B. Harvest of ApplesTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 647 Accepted Submission(s): 235 Problem DescriptionTher...
BZOJ 2653: middle(二分+主席树) Description一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。给你一个长度为n的序列s。回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。其中a<b<c<d。位置也从0开始标号。我会使用一些方式强制你在线。 Input第一行序列长度n。接下来n行...
牛客练习赛23 托米的游戏(概率,期望) 链接:https://www.nowcoder.com/acm/contest/156/F来源:牛客网 题目描述题目背景编不下去了托米有一棵有根树 T, 树根为1,每轮他会在剩下的子树中等概率一个点 u, 砍掉 u 的子树 (包含 u),如果树上的点都被砍光了,游戏结束。求出这个游戏进行的期望轮数,可以证明这个数一定是有理数,设他为 , 你需要告诉他一个整数 x 满足 输入描述...
ZOJ 2112 Dynamic Rankings(求动态区间第k大,树状数组套主席树) Dynamic RankingsTime Limit: 10 Seconds Memory Limit: 32768 KBThe Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find t...
BZOJ 4260: Codechef REBXOR(字典树求区间异或和) 4260: Codechef REBXORTime Limit: 10 Sec Memory Limit: 256 MBSubmit: 1738 Solved: 744[Submit][Status][Discuss]Description Input输入数据的第一行包含一个整数N,表示数组中的元素个数。第二行包含N个整数A1,A2,…,AN。 Outp...
BZOJ 2243: [SDOI2011]染色(树链剖分+线段树区间合并) Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,分别表示节点数和操作数;第二行包含n个正整数表示...
BZOJ 4034: [HAOI2015]树上操作(树链剖分) 4034: [HAOI2015]树上操作Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 7160 Solved: 2435[Submit][Status][Discuss]Description有一棵点数为 N 的树,以点 1 为根,且树点有边权。然后有 M 个操作,分为三种:操作 1 :把某个节点 x 的点权增加 a 。...
BZOJ 1036: [ZJOI2008]树的统计Count(树链剖分) 1036: [ZJOI2008]树的统计CountTime Limit: 10 Sec Memory Limit: 162 MBSubmit: 22104 Solved: 8996[Submit][Status][Discuss]Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CH...
HDU 6305 RMQ Similar Sequence(笛卡尔树) RMQ Similar SequenceTime Limit: 4000/2000 MS (Java/Others) M`emory Limit: 255535/255535 K (Java/Others)Total Submission(s): 953 Accepted Submission(s): 310 Problem DescriptionChiaki has ...
HDU 6315 Naive Operations(线段树) Naive OperationsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 502768/502768 K (Java/Others)Total Submission(s): 1244 Accepted Submission(s): 519 Problem DescriptionIn a galaxy far...
POJ 3162 Walking Race(树形dp+双指针+线段树 or 树形dp+二分+单调队列) Walking RaceTime Limit: 10000MS Memory Limit: 131072K Total Submissions: 5030 Accepted: 1276 Case Time Limit: 3000MS Descriptionflymouse’s sister wc is very capable at sports...
POJ 3744 Scout YYF I(概率dp) Scout YYF ITime Limit: 1000MS Memory Limit: 65536K Total Submissions: 10404 Accepted: 3056 DescriptionYYF is a couragous scout. Now he is on a dangerous mission which is to pen...
牛客网暑期ACM多校训练营(第一场)J-Different Integers(树状数组) 链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 题目描述Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), count(l2, r2),...
hdu 1560 DNA sequence(IDA*) DNA sequenceTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3872 Accepted Submission(s): 1870 Problem DescriptionThe twenty-first ce...
codeforce 1006 F. Xor-Paths(双向bfs) F. Xor-Pathstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a rectangular grid of size n×mn×m. Each cell has a number w...
hdu 1043 Eight(八数码问题,IDA*) EightTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29904 Accepted Submission(s): 7850Special Judge Problem DescriptionThe 15-puzz...
HDU 1724 Ellipse(辛普森积分) EllipseTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2749 Accepted Submission(s): 1240 Problem DescriptionMath is important!! Many ...
洛谷 P1613 题目描述小A的工作不仅繁琐,更有苛刻的规定,要求小A每天早上在6:00之前到达公司,否则这个月工资清零。可是小A偏偏又有赖床的坏毛病。于是为了保住自己的工资,小A买了一个十分牛B的空间跑路器,每秒钟可以跑2^k千米(k是任意自然数)。当然,这个机器是用longint存的,所以总跑路长度不能超过maxlongint千米。小A的家到公司的路可以看做一个有向图,小A家为点1,公司为点n,每条边长度均为一...
POJ 2018 Best Cow Fences(构造下凸折线) Best Cow FencesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 12527 Accepted: 4063DescriptionFarmer John's farm consists of a long row of N (1 <= N <= 100,000)fields. Each field conta...
poj 3321 Apple Tree(dfs序+树状数组) Apple TreeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 33660 Accepted: 10089DescriptionThere is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree....
codeforce 1004 E. Sonya and Ice Cream(树的直径) E. Sonya and Ice Creamtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSonya likes ice cream very much. She eats it even during programming competi...
hdu 2829 Lawrence(斜率dp) LawrenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4930 Accepted Submission(s): 2274Problem DescriptionT. E. Lawrence was a controversia...
hdu 3507 Print Article(斜率优化dp) Print ArticleTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 16378 Accepted Submission(s): 5042Problem DescriptionZero has an old printer th...
POJ 3207 Ikki's Story IV - Panda's Trick(2-sat) Ikki's Story IV - Panda's TrickTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 11303 Accepted: 4133Descriptionliympanda, one of Ikki’s friend, likes playing games with Ikki. Today after min...
hdu 3622 Bomb Game(二分+2-sat) Bomb GameTime Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5985 Accepted Submission(s): 2167Problem DescriptionRobbie is playing an interestin...
hdu 1814 Peaceful Commission (2-sat) Peaceful CommissionTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5202 Accepted Submission(s): 1660Problem DescriptionThe Public Peace Comm...
hdu 5478 Can you find it Can you find itTime Limit: 8000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1967 Accepted Submission(s): 832Problem DescriptionGiven a prime number C(1≤C≤...
hdu 5475 An easy problem(线段树) An easy problemTime Limit: 8000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2826 Accepted Submission(s): 1056Problem DescriptionOne day, a useless calcula...
hdu 5468 Puzzled Elena(dfs序+容斥原理) Puzzled ElenaTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1724 Accepted Submission(s): 552Problem DescriptionSince both Stefan and Damon...
BZOJ 1093: [ZJOI2007]最大半连通子图 1093: [ZJOI2007]最大半连通子图Time Limit: 30 Sec Memory Limit: 162 MBSubmit: 4070 Solved: 1639[Submit][Status][Discuss]Description 一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一...
codeforce 1000 E. We Need More Bosses E. We Need More Bossestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend is developing a computer game. He has already decided how the ga...
洛谷 p1484 题目描述cyrcyr今天在种树,他在一条直线上挖了n个坑。这n个坑都可以种树,但为了保证每一棵树都有充足的养料,cyrcyr不会在相邻的两个坑中种树。而且由于cyrcyr的树种不够,他至多会种k棵树。假设cyrcyr有某种神能力,能预知自己在某个坑种树的获利会是多少(可能为负),请你帮助他计算出他的最大获利。输入输出格式输入格式:第一行,两个正整数n,k。第二行,n个正整数,第i个数表示在直线上从...
POJ 1113 Wall(凸包) WallTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 40047 Accepted: 13648DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's...
POJ 2187 Beauty Contest(凸包+旋转卡壳) Beauty ContestTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 41266 Accepted: 12779DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning th...
HDU 3739 Anti LIS(最小割) Anti LISTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 607 Accepted Submission(s): 157Problem DescriptionHaven't you heard about Lost?Having...
CodeForce 985 E. Pencils and Boxes(dp+树状数组) E. Pencils and Boxestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMishka received a gift of multicolored pencils for his birthday! Unfortunately...
CodeForce 985 D. Sand Fortress (二分) D. Sand Fortresstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are going to the beach with the idea to build the greatest sand castle ever in...
CodeForce 986 C. AND Graph(dfs+位运算) C. AND Graphtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a set of size mm with integer elements between 00 and 2n−12n−1 inclusive...
CodeForce 990 E. Post Lamps E. Post Lampstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAdilbek's house is located on a street which can be represented as the OX axis. This ...
CodeForce 994 B. Knights of a Polygonal Table(线段树) B. Knights of a Polygonal Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlike Knights of a Round Table, Knights of a Polygonal Table depriv...
CodeForce 981 D. Bookshelves(贪心+dp) D. Bookshelvestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with s...
CodeForce 981 E Addition on Segments(线段树+bitset优化01背包) E. Addition on Segmentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGrisha come to a contest and faced the following problem.You are given an a...
POJ 2104 K-th Number(主席树) K-th NumberTime Limit: 20000MS Memory Limit: 65536KTotal Submissions:66103 Accepted: 23288Case Time Limit: 2000MSDescriptionYou are working for Macrohard company in data structures department. After f...
codeforce 149 D. Coloring Brackets(区间dp) D. Coloring Bracketstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce Petya read a problem about a bracket sequence. He gave it much thought bu...
HDU 2476 String painter(区间dp) String painterTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5659 Accepted Submission(s): 2695Problem DescriptionThere are two strings A and...
HDU 5151 Sit sit sit(区间dp) Sit sit sitTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 531 Accepted Submission(s): 276Problem DescriptionThere are N chairs in a row and ...
HDU 5693 D Game(区间dp) D GameTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1063 Accepted Submission(s): 380Problem Description众所周知,度度熊喜欢的字符只有两个:B 和D。今天,它发明了一个游戏:D...
HDU 4283 You Are the One(区间dp) You Are the OneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5303 Accepted Submission(s): 2559Problem Description The TV shows such as You...
HDU 5900 QSC and Master (区间dp) QSC and MasterTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2850 Accepted Submission(s): 1005Problem DescriptionEvery school has some leg...
HDU 5115 Dire Wolf(区间dp) Dire WolfTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3340 Accepted Submission(s): 2000Problem DescriptionDire wolves, also known as Dar...
HDU 4507 吉哥系列故事——恨7不成妻(数位dp) 吉哥系列故事——恨7不成妻Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 5696 Accepted Submission(s): 1848Problem Description 单身! 依然单身! 吉哥依然单身! DS级码农吉...
SPOJ 10606 Balanced Numbers(数位dp) BALNUM - Balanced Numbersno tags Balanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if:1) Every even digit appears an odd number o...
codeforce 55D D. Beautiful numbers(数位dp) D. Beautiful numberstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVolodya is an odd boy and his taste is strange as well. It seems to him that a...
POJ 3252 Round Numbers(数位dp) Round NumbersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 15488 Accepted: 6312DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Ston...
HDU 4352 XHXJ's LIS(数位dp) XHXJ's LISTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3838 Accepted Submission(s): 1604Problem Description#define xhxj (Xin Hang senior s...
HDU 3709 Balanced Number(数位dp) Balanced NumberTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 7215 Accepted Submission(s): 3464Problem DescriptionA balanced number is a no...
HDU 3652 B-number(数位dp) B-numberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8160 Accepted Submission(s): 4822Problem DescriptionA wqb-number, or B-number for sho...
HDU 4734 F(x)(数位dp) F(x)Time Limit: 1000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7761 Accepted Submission(s): 3046Problem DescriptionFor a decimal number x with n digits (...
2015 ACM Amman Collegiate Programming Contest L. Alternating Strings II(dp+线段树) #include<bits/stdc++.h>using namespace std;char t[100003];int dp[100003];struct node{ int left,right,mid; int x;}tree[400004];void build(int l,int r,int rt){ tree[rt].left=l;...
2015 ACM Amman Collegiate Programming Contest I. Bahosain and Digits 题解:第一维枚举长度,第二维枚举0~9 代表最后所有数字的最终状态。当长度确定为i后,第一个数要想增加,操作的一定是区间1~i,当第一个数满足后,操作第二个数时,不能在影响第一个数,因此操作区间一定是2~i+1。代码:#include<bits/stdc++.h>using namespace std;char t[255];int a[255],s[255];i...
HDU 3586 Information Disturbing(树形dp+二分) Information DisturbingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 4017 Accepted Submission(s): 1399Problem DescriptionIn the battlefield...
POJ 2486 Apple Tree Apple TreeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11728 Accepted: 3966DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are ...