题目链接:http://codeforces.com/gym/101128 题目数7/10 Rank 34/209 A: 题意:给出一张n个点的有向图表示一家有n个员工的公司的隶属图,u->v表示u是v的上司,现在老板要提拔一些人,但是规定如果一个员工被提拔,那么他的上司也要被提拔,现给出两个整数a和b表示一区间,求三个值,第一个值表示如果提拔a个人那么这n个中必须要被提拔的人数,第二个值表示如果提拔b个人那么这n个人中必须要被提拔的人数,第三个值表示就算提拔b个人也不会被提拔的人数 解法:前两…
时间:2017/9/8 题目8/10 Rank 5/150 体会:三星的题目和国内区域赛差距大,大多数题读懂题意就能做,所以静心读题是关键,套路性太深. A: 题意:给出一个算式,算式中的数字用大写字母代替.每个字母只能代替一个数字,一个数字也只能被一个字母代替.有多少种数字分配方式可以使得这个算式成立? 解法:爆搜.一共不超过十个字母,把这十个字母列出来然后进行dfs分配数字,分配完后就进行验证是否可以满足式子,还要考虑累加的n-1个数不能是前导0,. #include <bits/stdc+…
https://vjudge.net/contest/174235#problem/D [题意] 给定n个已知size的帆布,要给这n块帆布涂上不同的颜色,规则是这样的: 每次选择一种颜色C 对于颜色为C的所有帆布都要涂上颜色,其中前F个涂为颜色X,剩下的涂为颜色Y,X和Y都是不同于任何已知颜色的颜色 每次涂颜色用掉的墨水用量都是帆布的size 重复步骤2和3直到所有的帆布都是不同的颜色 求最少要多少墨水 [思路] 第一次涂把帆布变成两种颜色,剩下每次涂色都是增加一种颜色,所以n块帆布一定是涂n…
https://vjudge.net/contest/174235#problem/H [题意] 求[x,y]之间有多少个Sheldon Number Sheldon Number是二进制满足以下条件的数: 可以写成ABABAB . . . ABA或ABABAB . . . AB,其中,A是连续的n个1,B是连续的m个0 这个二进制数可以没有0但不能没有1 [思路] 对于确定的n,m,和二进制数的长度len,二进制数唯一确定的,所以按n,m,len枚举的话复杂度为64^3 我们可以预处理所有的S…
题意 一个公司里有E个员工P个上下级关系.这个公司有一种晋升制度.如果要晋升员工a,那么必须要先晋升a的所有领导.给出一个区间[A,B],如果要晋升A个员工,有哪些员工是一定会被晋升的?如果要晋升B个员工,有哪些员工是一定会被晋升的?如果晋升B个员工,有哪些员工是一定不会被晋升的? 分析 这个描述再加上那个样例的图片实在太TM像拓扑排序了啊!当时在场上写了个拓扑排序然后WA的很惨 如果要晋升A个员工,哪些员工是一定会被晋升的?当这个员工的下属数量(包括他自己)大于n-A的时候,则必须晋升它 那么…
C. Canvas Painting 合并果子. E. Wooden Signs \(dp(i,l,r)\)表示第\(i\)块木板的长度区间为\([l,r]\)的方案数,根据题意,\(l\)或\(r\)会等于\(p_i\). 转移的时候只需要枚举跟\(p_{i-1}\)相关的区间即可. F. Landscaping 对于每个格子拆成两个点,分别表示高地势与低地势,这两个点分别和\(S,T\)连边,容量为属于不同集合的代价. 每个格子和它相邻格子属于不同地势时,连一条容量为\(A\)的边. 对于\…
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…
题目链接: 2018 ICPC Pacific Northwest Regional Contest - I-Inversions 题意 给出一个长度为\(n\)的序列,其中的数字介于0-k之间,为0表示这个位置是空的.现在可以在这些空的位置上任意填入1-k之间的数字(可以重复).问最多可以总共有多少对逆序对.(如果\(i<j,p_i>p_j\),则称\((i,j)\)是一对逆序对) \(1\leq n\leq 2*10^5,\ 1\leq k\leq 100\) 思路 第一步,先证明最优的填…
一个简单的题: 感觉像计算几何,其实并用不到什么计算几何的知识: 方法: 首先对每条边判断一下,看他们能够把平面分成多少份: 然后用边来对点划分集合,首先初始化为一个集合: 最后如果点的集合等于平面的份数,就说明每块都有一个士兵: 代码: #include<cstdio> #include<vector> #define maxn 105 #define maxm 50005 using namespace std; int a[maxn],b[maxn],c[maxn]; lon…
字符串处理的题目: 学习了一下string类的一些用法: 这个代码花的时间很长,其实可以更加优化: 代码: #include<iostream> #include<string> using namespace std; ]= {"he","h","li","be","b","c","n","o","f"…
题目不难,感觉像是一个拓扑排序,要用双端队列来维护: 要注意细节,不然WA到死  = =! #include<cstdio> #include<cstring> #include<vector> #define maxn 100005 using namespace std; *maxn],count[][maxn],tail,head,n,m,in[maxn]; vector<int>ve[maxn]; int solve(int lab) { head=…
http://acm.hunnu.edu.cn/online/problem_pdf/CERC2012/H.pdf HUNNU11377 题意:飞镖环有十个环,没个环从外到里对应一个得分1~10,每个环有一定的半径,给出n次丢飞镖的坐标,求出得分 思路:直接算出左边离原点的半径判断在哪个环里即可,然后求出半径,一开始将判断全部写成了函数,在循环里调用超时了,将所有判断移到循环内就AC了,坑! #include <stdio.h> #include <math.h> #include…
A. Assignment Algorithm 按题意模拟即可. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<que…
A. ABB #include <bits/stdc++.h> using namespace std; #define PB push_back #define ZERO (1e-10) #define INF int(1e9+1) #define CL(A,I) (memset(A,I,sizeof(A))) #define DEB printf("DEB!\n"); #define D(X) cout<<" "<<#X&qu…
2015 UESTC Winter Training #8 The 2011 Rocky Mountain Regional Contest Regionals 2011 >> North America - Rocky Mountain 开始时貌似是UVAlive挂了,无论交什么都WA,后来转战HDU 这次水题比较多,其中B题据说有更加高级的方法. G题WA了两发,才发现竟然没有输出Case!!! 未完成:D F H I J A - Iterated Difference 水题,模拟迭代即可…
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranking List 题意 输入关系组数n和n组关系,每组关系是s1 > s2,问第一出现矛盾的组,或者没有矛盾就输出0. 解题思路 第一感觉是拓扑排序,未完,又写了一个深搜的传递闭包,1 A,和2018年河南省赛的题很像. 代码 #include <cstdio> #include <ma…
摘要 本文主要给出了2014-2015 ACM-ICPC, Asia Xian Regional Contest的部分题解,说明了每题的题意.解题思路和代码实现,意即熟悉区域赛比赛题型. Built with Qinghuai and Ari Factor 题意 判断是否是Q数列,只要数列中每个数均能够被3整除就是Q数列. 解题思路 需要特判一下0的情况. 代码 #include <cstdio> int main() { int T; int n; ; scanf("%d"…
摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其他区域赛的准备有借鉴意义. Function and Function 题意 给出x和k,计算gk(x). 解题思路 通过观察发现,g函数经过一定次数的递推一定会在0和1之间变换,所以循环内加判断提前结束递推即可. 易错分析 注意计算f(0)返回的是1的问题,下面的写法避免了这种错误. 代码实现 #…
Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
The 2018 ACM-ICPC Asia Qingdao Regional Contest 青岛总体来说只会3题 C #include<bits/stdc++.h> using namespace std; #define maxn 3000005 char a[maxn],b[maxn]; int c[maxn],ll[maxn],rr[maxn]; int main(){ int t; cin>>t; while(t--){ int n; scanf("%d&qu…
2017-2018 ACM-ICPC, Asia Tsukuba Regional Contest A Secret of Chocolate Poles 思路:暴力枚举黑巧克力的个数和厚黑巧克力的个数 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define s…
2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) 思路: A Exam 思路:水题 代码: #include<bits/stdc++.h> using namespace std; int main(){ int k; scanf("%d",&k); ],s2[]; scanf("%s%s",s1,s2); ; int n=strlen(s1); ;i<n;i++)…
GCC Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 3867    Accepted Submission(s): 1272 Problem Description The GNU Compiler Collection (usually shortened to GCC) is a compiler system produc…
2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest A - Arranging Wine 题目描述:有\(R\)个红箱和\(W\)个白箱,将这些箱子分成若干堆,使得每一堆只有一种颜色,然后将这些堆排成一排,使得相邻的堆的颜色不一样,并且每堆红箱的个数不能超过\(d\),问有多少种方案. solution 不会. B - Barcode 题目描述:有一排\(n\)个球,现在要给这\(n\)个球涂成红色或蓝色,使得红色球的个数等于蓝色球的个数…
ACM ICPC 2010–2011, Northeastern European Regional Contest St Petersburg – Barnaul – Tashkent – Tbilisi, November 24, 2010 Problem A. Alignment of CodeProblem B. Binary OperationProblem C. Cactus RevolutionProblem D. Dome of CircusProblem E. Evacuati…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest A.Average Score B.Building Fire Stations C.Card Game D.Domination E.Excavator Contest F.Fiber-optic Network G.Garden and Sprinklers H.Hierarchical Notation I.Information Entropy J.Jacobi Pattern K.Kn…
// Change of Scenery 1 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <utility> #include <queue> using namespace std; typedef long long ll; typedef pair<…
Method ringing is used to ring bells in churches, particularly in England. Suppose there are 6 bells that have 6 different pitches. We assign the number 1 to the bell highest in pitch, 2 to the second highest, and so on. When the 6 bells are rung in…
In an unprecedented turn of events, goblins recently launched an invasion against the Nedewsian city of Mlohkcots. Goblins—small, green critters—love nothing more than to introduce additional entropy into the calm and ordered lives of ordinary people…
Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device can record kk different TV shows simultaneously, and whenever a sh…