Recently, Bob has just learnt a naive sorting algorithm: merge sort. Now, Bob receives a task from Alice.Alice will give Bob N sorted sequences, and the i-th sequence includes ai elements. Bob need to merge all of these sequences. He can write a prog…
A I Count Two Three I will show you the most popular board game in the Shanghai Ingress Resistance Team. It all started several months ago. We found out the home address of the enlightened agent Icount2three and decided to draw him out. Millions of m…
题目链接:http://codeforces.com/gym/101149/problem/G 题目大意:给你n对数字,为(a[i], b[i]),给你m对数字,为(w[i], c[i]).给n对数字找配对,这个配对必须是m中的,而且m中的每个只能和n中的配对一次. 配对条件,w[i]>=a[j], c[i]>=b[j]即可配对. 输出n个数字,每个数字在m个数字当中的配对. 思路:假定n对数字的是x,m对数字的是y 离散化以后sort一下x和y,这样我们就得到了第一维是排序好了的. 然后我们…
ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków Problem A: Rubik’s RectangleProblem B: What does the fox say?Problem C: Magical GCDProblem D: SubwayProblem E: EscapeProblem F: DraughtsProblem G: History courseProblem H: C…
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 "max" "min" "+" "-" "" "/"对随机数 "?" 进行处理,使最后式子得到c的概率超过1/2 (所有数字均在0~255之间,"+" "…
Solution A:Careful Thief 题意:给出n个区间,每个区间的每个位置的权值都是v,然后找长度为k的区间,使得这个区间的所有位置的权值加起来最大,输出最大权值, 所有区间不重叠 思路:贪心的想法,长度为k的区间的起始点肯定是某个区间的起始点,或者长度为k的区间的结束点肯定是某个区间的结束点. 因为存在最优的答案,它的起点不在某个区间的起点,那么只有两种情况. 1° 不属于任何已知区间 2° 在某个已知区间的内部 首先考虑第一种情况  如果不属于任何已知区间,那么根据贪心,我肯定…
Description You are the manager of a small soccer team. After seeing the shameless behavior of your team during the match, you are mad at all of the current players. Therefore, you have made a huge decision: put these players on the substitution benc…
A: 简单题,因为题目中说了不会有数据相同: #include<cstdio> #include<algorithm> #define maxn 200005 using namespace std; struct node { ]; int id; bool operator <(const node &t)const { ]<t.a[]; } }no[maxn]; int bb[maxn],cnt,n; int main() { scanf("%d…
第一次玩ACM...有点小紧张小兴奋.这题目好难啊,只是网赛就这么难...只把最简单的两题做出来了. 题目1: 代码: //#define _ACM_ #include<iostream> #include<cstring> #include<string> #include<vector> #include<map> #include<set> using namespace std; char line[111], word[11…
题目链接:http://codeforces.com/gym/101149/problem/D 题目大意: 堡垒受到攻击.堡垒是n*m的矩阵,矩阵里刚开始都是平地,然后那个数值表示在当前平地上建一面墙需要a[i][j]的时间.目前我们在位置(r, c),我们找一种方法,把(r,c)全部围起来需要的最短时间? 思路:拆点,拆成in和out两个,in和out之间的cap就是a[i][j],然后就是简单的建边拉. //看看会不会爆int!数组会不会少了一维! //取物问题一定要小心先手胜利的条件 #i…