The Team of ACM/ICPC

ACM是一种什么样的体验

ICPC Scoreboard

Problem Description Charles is the contest director for the ICPC Tumbolian regional contest. His responsibility is ensuring the contest flows smoothly, that the contest rules are applied fairly, and, of course, announcing the final contest ranking. According to ICPC rules, a team with more solved problems ranks above a team with less solved problems. If two teams have the same number of solved problems, the team with the smaller total penalty ranks above the team with the larger total penalty (in case both teams have the same number of solved problems and the same penalty, Charles considers them as tied). The total penalty for a team is the sum of all the problem penalties of the problems that team has solved. The problem penalty for a problem is TP +EP ×FA, where TP is the time penalty for that problem, EP is the contest’s error penalty and FA is the number of failed attempts at solving the problem before submitting a correct solution. The time penalty for a problem is the time since the start of the contest, in minutes, that the team needed to solve the problem. The error penalty is a positive integer chosen by the contest director, designed to reward teams that submit correct solutions on the first attempt. Charles wants to change the error penalty from the “standard” value of 20 minutes to stir things up. To study the effects of that change on the final rankings, he wants to know the range of error penalties that don’t change the final standings. In other words, if team A is ahead of team B in the original standings, then A should be ahead of B in the modified standings; if A and B are tied in the original standings, they should also be tied in the modified standings (the original standings are the ones obtained with an error penalty of 20 minutes). Charles has been very busy organizing the Tumbolian regional, so he asked you to make a program that will compute the range for him. Input The input contains several test cases. The first line of each test case contains two integers T and P separated by a single space, indicating the number of teams and the number of problems, respectively (2 <= T <= 100, 1 <= P <= 10). Each one of the next T lines describes the performance of a team. A team’s performance description is a line containing P problem descriptions separated by single spaces. Teams are not necessarily given in order of their final standings. Each problem description is a string “A/S”, where A is an integer representing the number of attempts that the corresponding team made at solving that problem (0 <= A <= 100), and S is either “-”, if the team did not solve that problem, or an integer indicating the number of minutes it took for the team to submit a correct solution (1 <= S <= 300). Attempts made after the first correct submission are not counted. The end of input is indicated by T = P = 0. Output For each test case in the input print two positive integers separated by a single space, indicating the smallest and largest error penalties that would not change the final ranking. If there is no upper bound for the error penalty, print a “*” instead of the upper bound. Sample Input 5 3 0/- 0/- 0/- 2/- 2/- 1/- 1/60 1/165 1/- 1/80 0/- 2/120 0/- 1/17 0/- 4 2 17/- 5/- 2/7 3/- 3/- 2/- 1/15 0/- 3 2 1/- 2/15 2/53 1/17 1/70 1/20 0 0 Sample Output 1 24 9 * 20 20

The Team of ACM/ICPC

Problem Description There are 3 people in a team of ACM/ICPC. Every member of the team will occasionally make some mistakes in the contest. So Mr.F tests every one and everybody gets a Mistake Value x. If the Mistake Values of the 3 members of a team are respectively a, b, c, then the Mistake Value of the team is m = min{ |a-b|, |b-c|, |c-a| }. Your job is to find the best plan to minimize M which is the sum of all the Mistake Value of teams. Input In the first line, there are two integers N and K. N is the number of people who will make teams and K is the number of teams which is supposed to make. (3<= N <=100000) (0<= k <= N/3 ) There are N lines followed. Each line has an integer D, which is the Mistake Value of the person.(0<=D<=1000000000) Output Print the minimal M in one line. Sample Input 7 2 1 5 3 2 4 7 9 Sample Output 2

ICPC Score Totalizer Software

Description The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance. Basically, scores given to a contestant's performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer. You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program. Input The input consists of a number of datasets, each corresponding to a contestant's performance. There are no more than 20 datasets in the input. A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges' names are kept secret. The end of the input is indicated by a line with a single zero in it. Output For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line. Sample Input 3 1000 342 0 5 2 2 9 11 932 5 300 1000 0 200 400 8 353 242 402 274 283 132 402 523 0 Sample Output 342 7 300 326

Gao

Who is cpcs? Every one in ZJU ACM-ICPC team knows him. Although he has been graduated from ZJU, he is still active in ZOJ and many contests. cpcs is the legendary figure in ZJU ACM-ICPC history. It is not only because he has passed nearly all the problems on ZOJ, but also because his very famous function name "gao" which is now widely spreaded and used by many ACMers. "gao" in Chinese means to do something but it's not that formal in grammar. So it is usually used verbally. In addition, "gao" can be explained as a spirit, a belief, even an attitude to life, which makes cpcs use "gao" as most of the function names (Of course there should be some functions named such as "main" in C or C++). One day, cpcs got a map of the city he lived in. There were N buildings (numbered from 0 to N - 1) in the map with the building he was in marked as 0. Between the buildings, there were some unidirectional roads. He then wrote a program with function "gao" that could calculate all the shortest paths from building 0 to all the building. Here, there might be more than one shortest paths to a building. Now he wanted to know, for each query of buildings, how many shortest paths that he figured out with function "gao" passed through the queried building. Note that if a building is unreachable from building 0, no shortest path would passes through it. Input There are multiple test cases. For each case, the first line is three numbers N, M, Q (1 ≤ Q ≤ N ≤ 10000, 1 ≤ M ≤ 50000) indicating the number of buildings, the number of roads and the number of queries. Next is M lines each containing three numbers a, b, d (0 ≤ a, b < N, 0 < d ≤ 200) indicating that there is a road of length d from building a to building b. Next is Q lines each containing one integer qi indicating a query to a building. Most cases are small, no more than 5 large cases. Output In each case, for each query, you should print one line with the number of shortest paths that pass through the building. Since the answer may be very large, you only need to print the last 10 digits of the answer. Sample Input 4 4 4 0 1 2 0 2 2 1 3 1 2 3 1 0 1 2 3 Sample Output 0000000005 0000000002 0000000002 0000000002 Hint In the sample, there are 5 shortest paths. 0 0 -> 1 0 -> 2 0 -> 1 -> 3 0 -> 2 -> 3 Therefore, building 0 appears 5 times in the shortest paths, while building 1, 2 and 3 each appears 2, 2, 2 times.

Problem Description 　　最近，小明出了一些ACM编程题，决定在HDOJ举行一场公开赛。 　　假设题目的数量一共是n道，这些题目的难度被评级为一个不超过1000的非负整数，并且一场比赛至少需要一个题，而这场比赛的难度，就是所有题目的难度之和，同时，我们认为一场比赛与本场题目的顺序无关，而且题目也不会重复。 　　显而易见，很容易得到如下信息： 　　假设比赛只用1个题目，有n种方案； 　　假设比赛使用2个题目，有(n-1)*n/2种方案； 　　假设比赛使用3个题目，有(n-2)*(n-1)*n/6种方案； 　　............ 　　假设比赛使用全部的n个题目，此时方案只有1种。 　　 　　经过简单估算，小明发现总方案数几乎是一个天文数字！ 　　为了简化问题，现在小明只想知道在所有的方案里面第m小的方案，它的比赛难度是多少呢？ Input 输入数据的第一行为一个整数T（1 <= T <= 20），表示有T组测试数据。 每组测试数据第一行为两个整数n, m（0 < n, m <= 10000），表示现在有n个题目，现在要求第m小的方案的比赛难度。接下来第二行有n个数字，分别表示这n个题目的难度值。 Output 对于每组测试数据，输出一行"Case #c: ans"（不包含引号），ans 表示要求的第m小的比赛难度，输入数据保证存在第m小的方案，具体参见样例。 Sample Input 2 5 6 1 1 1 1 1 5 25 1 2 3 4 5 Sample Output Case #1: 2 Case #2: 11

ACM Lotteryneed

n ZJU ICPC 2005 Summer Camp, javaman, whose nick name is CaiPiaoGe, are attending this summer camp in YuQuan Campus of Zhejiang University. Everyday, when he finishes supper, he always goes to buy the ACM lotteries next to the YuQuan Campus. The price of this kind of ACM lottery is given in the format Balloon.Idea.Think. Seventeen Ideas to a Balloon and twenty-nine Thinks to an Idea, it's easy enough. After javaman has bought one ACM lottery, he scrapes off the silver paper on the lottery and gets a beautiful ICPC icon. There are N kinds of ICPC icons. If javaman could get all the N kinds of ICPC icons, he will get the most glorious award in the ACM/ICPC area, called GoldenBear Cup. Now, javaman wishes to know that how much money he should pay for the ACM lotteries in average cases in order to get the GoldenBear Cup. Input: The input will consist of several test cases. Each case will contain the price of ACM lottery(a string of no more than 16 characters) and an integer N indicating N kinds of ICPC icons, 0 < N <= 107. Output: For each case, output the money javaman should pay. Please note that the money should be accurated up to Balloons. Sample Input: 1.0.0 1 Sample Output: 1

Rotating Scoreboard

Description This year, ACM/ICPC World finals will be held in a hall in form of a simple polygon. The coaches and spectators are seated along the edges of the polygon. We want to place a rotating scoreboard somewhere in the hall such that a spectator sitting anywhere on the boundary of the hall can view the scoreboard (i.e., his line of sight is not blocked by a wall). Note that if the line of sight of a spectator is tangent to the polygon boundary (either in a vertex or in an edge), he can still view the scoreboard. You may view spectator's seats as points along the boundary of the simple polygon, and consider the scoreboard as a point as well. Your program is given the corners of the hall (the vertices of the polygon), and must check if there is a location for the scoreboard (a point inside the polygon) such that the scoreboard can be viewed from any point on the edges of the polygon. Input The first number in the input line, T is the number of test cases. Each test case is specified on a single line of input in the form n x1 y1 x2 y2 ... xn yn where n (3 ≤ n ≤ 100) is the number of vertices in the polygon, and the pair of integers xi yi sequence specify the vertices of the polygon sorted in order. Output The output contains T lines, each corresponding to an input test case in that order. The output line contains either YES or NO depending on whether the scoreboard can be placed inside the hall conforming to the problem conditions. Sample Input 2 4 0 0 0 1 1 1 1 0 8 0 0 0 2 1 2 1 1 2 1 2 2 3 2 3 0 Sample Output YES NO

Doing Homework again

Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will reduce his score of the final test. And now we assume that doing everyone homework always takes one day. So Ignatius wants you to help him to arrange the order of doing homework to minimize the reduced score. Input The input contains several test cases. The first line of the input is a single integer T that is the number of test cases. T test cases follow. Each test case start with a positive integer N(1<=N<=1000) which indicate the number of homework.. Then 2 lines follow. The first line contains N integers that indicate the deadlines of the subjects, and the next line contains N integers that indicate the reduced scores. Output For each test case, you should output the smallest total reduced score, one line per test case. Sample Input 3 3 3 3 3 10 5 1 3 1 3 1 6 2 3 7 1 4 6 4 2 4 3 3 2 1 7 6 5 4 Sample Output 0 3 5

Select Problem

Problem Description One day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting game. He wants to take part in the game. But as we all know, you can't get good result without teammates. So, he needs to select two classmates as his teammates. In this game, the IQ is very important, if you have low IQ you will WanTuo. Dudu's IQ is a given number k. We use an integer v[i] to represent the IQ of the ith classmate. The sum of new two teammates' IQ must more than Dudu's IQ. For some reason, Dudu don't want the two teammates comes from the same class. Now, give you the status of classes, can you tell Dudu how many ways there are. Input There is a number T shows there are T test cases below. (T≤20) For each test case , the first line contains two integers, n and k, which means the number of class and the IQ of Dudu. n ( 0≤n≤1000 ), k( 0≤k<231 ). Then, there are n classes below, for each class, the first line contains an integer m, which means the number of the classmates in this class, and for next m lines, each line contains an integer v[i], which means there is a person whose iq is v[i] in this class. m( 0≤m≤100 ), v[i]( 0≤v[i]<231 ) Output For each test case, output a single integer. Sample Input 1 3 1 1 2 1 2 2 1 1 Sample Output 5

Rolling table 怎么写这个程序

Problem Description After the 32nd ACM/ICPC regional contest, Wiskey is beginning to prepare for CET-6. He has an English words table and read it every morning. One day, Wiskey's chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time. The table has n*n grids. Your task is tell Wiskey the final status of the table. Input Each line will contain two number. The first is postive integer n (0 < n <= 10). The seconed is signed 32-bit integer m. if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times. Following n lines. Every line contain n characters. Output Output the n*n grids of the final status. Sample Input 3 2 123 456 789 3 -1 123 456 789 Sample Output 987 654 321 369 258 147

Hints of sd0061

Problem Description sd0061, the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal with m coming contests. sd0061 has left a set of hints for them. There are n noobs in the team, the i-th of which has a rating ai. sd0061 prepares one hint for each contest. The hint for the j-th contest is a number bj, which means that the noob with the (bj+1)-th lowest rating is ordained by sd0061 for the j-th contest. The coach asks constroy to make a list of contestants. constroy looks into these hints and finds out: bi+bj≤bk is satisfied if bi≠bj, bi<bk and bj<bk. Now, you are in charge of making the list for constroy. Input There are multiple test cases (about 10). For each test case: The first line contains five integers n,m,A,B,C. (1≤n≤107,1≤m≤100) The second line contains m integers, the i-th of which is the number bi of the i-th hint. (0≤bi<n) The n noobs' ratings are obtained by calling following function n times, the i-th result of which is ai. unsigned x = A, y = B, z = C; unsigned rng61() { unsigned t; x ^= x << 16; x ^= x >> 5; x ^= x << 1; t = x; x = y; y = z; z = t ^ x ^ y; return z; } Output For each test case, output "Case #x: y1 y2 ⋯ ym" in one line (without quotes), where x indicates the case number starting from 1 and yi (1≤i≤m) denotes the rating of noob for the i-th contest of corresponding case. Sample Input 3 3 1 1 1 0 1 2 2 2 2 2 2 1 1 Sample Output Case #1: 1 1 202755 Case #2: 405510 405510

Beer Problem

Everyone knows that World Finals of ACM ICPC 2004 were held in Prague. Besides its greatest architecture and culture, Prague is world famous for its beer. Though drinking too much is probably not good for contestants, many teams took advantage of tasting greatest beer for really low prices. A new beer producing company Drink Anywhere is planning to distribute its product in several of the n European cities. The brewery is located near Prague, that we would certainly call city number 1. For delivering beer to other cities, the company is planning to use logistics company Drive Anywhere that provides m routes for carrying goods. Each route is described by the cities it connects (products can be transported in either direction), its capacity --- the number of barrels of beer that can be transported along this route each day, and the cost of transporting one barrel of beer along it. To deliver beer to some city it may be necessary (or advantageous) to use several routes consequently, and maybe even deliver beer using several different paths. Each city is in turn characterized by the price that local pubs and restaurants are ready to pay for one barrel of beer. You may assume that demand for beer is essentially unlimited in each city, since this is the product that will always find its consumer. Drink Anywhere is not planning to distribute its beer in Prague for a while, because of the high competition there, so it is just planning to provide beer to other cities for now. Help it to find out, what is the maximal income per day it can get. Input The first line of the input file contains n and m --- the number of cities in Europe we consider and the number of delivery routes respectively (2 ≤ n ≤ 100), 1 ≤ m ≤ 2000). The next line contains n - 1 integer numbers --- prices of a barrel of beer in European cities 2, 3 ..., n respectively (prices are positive integers and do not exceded 1000). The following m lines contain four integer numbers each and describe delivery routes. Each route is specified by the numbers of cities it connects, its capacity, and the price of transporting one barrel of beer along it (the capacity and the price are positive integers, they do not exceed 1000). There are multiple cases. Process to the end of file. Output Output the maximal income the company can get each day. Sample Input 4 4 80 50 130 1 2 80 50 2 4 40 90 3 1 40 60 3 4 30 50 Sample Output 3000

acm实验室正在进行acm-icpc十大最重要算法投票。成员们在选举前，都在以各种方式猜测得票结果，而在结果出来后，大家都希望能知道他们的猜测结果是否正确。在搜集了同学们的猜测和最终投票的结果后，因为数据量太大了，所以大家把这个任务交编程最好的你。 Input 输入只有一组数据，其格式如下：第一行有两个数p，g( 1 ≤ p ≤ 50 且1 ≤ g ≤ 10000)，分别代表候选算法的个数和猜测的个数。 接下来有p行，每行由一个不超过20字符的字符串代表候选算法的名字（仅由字母数字组成，长度 <= 20）和得票的百分比组成（保留一位小数点）。 在候选人之后还有g行，每行代表一个猜测。 一个猜测的格式类似：P1 + P2 + ... + Pk COMP n, 其中P1 到 Pk 代表候算法的名称， COMP 是比较关系包括 <, >, <=, >= 或者 = 。 n 是一个在[0,100]之间的一个整数。 Output 对于每个猜测，计算得票百分比的和，并且和指定的整数n进行比较。输出猜测编号和猜测是否正确。参考样例的输出。 Sample Input 6 5 prime 30.7 kruskal 20.8 kmp 12.1 dp 11.0 netflow 7.5 spfa 7.2 dp > 11 prime + kruskal < 50 kruskal + spfa >= 28 dp + kruskal + prime <= 42 prime + dp + kruskal + netflow = 70 Sample Output Guess #1 was incorrect. Guess #2 was incorrect. Guess #3 was correct. Guess #4 was incorrect. Guess #5 was correct. 这是题目，我不会进行后面的比较求值。跪求大佬们帮忙。

Rolling table

Problem Description After the 32nd ACM/ICPC regional contest, Wiskey is beginning to prepare for CET-6. He has an English words table and read it every morning. One day, Wiskey's chum wants to play a joke on him. He rolling the table, and tell Wiskey how many time he rotated. Rotate 90 degrees clockwise or count-clockwise each time. The table has n*n grids. Your task is tell Wiskey the final status of the table. Input Each line will contain two number. The first is postive integer n (0 < n <= 10). The seconed is signed 32-bit integer m. if m is postive, it represent rotate clockwise m times, else it represent rotate count-clockwise -m times. Following n lines. Every line contain n characters. Output Output the n*n grids of the final status. Sample Input 3 2 123 456 789 3 -1 123 456 789 Sample Output 987 654 321 369 258 147

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内，我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年，古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合，再掺入煅烧石灰石制成的石灰，由此得来了人...

loonggg读完需要3分钟速读仅需 1 分钟大家好，我是你们的校长。我之前讲过，这年头，只要肯动脑，肯行动，程序员凭借自己的技术，赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

MySQL数据库面试题（2020最新版）

HashMap底层实现原理，红黑树，B+树，B树的结构原理 Spring的AOP和IOC是什么？它们常见的使用场景有哪些？Spring事务，事务的属性，传播行为，数据库隔离级别 Spring和SpringMVC，MyBatis以及SpringBoot的注解分别有哪些？SpringMVC的工作原理，SpringBoot框架的优点，MyBatis框架的优点 SpringCould组件有哪些，他们...

《经典算法案例》01-08：如何使用质数设计扫雷（Minesweeper）游戏

《Oracle Java SE编程自学与面试指南》最佳学习路线图（2020最新版）