这次没去考试:就考试结尾场外交题了一道题。B题是补得。
因为和女朋友和好啦 开心 我以后要好好对她 不可以惹她生气了。好好学习。加油!
A
The ACM International Collegiate Programming Contest has been held in Vietnam for more than 1010 years. The contest is a great chance for the students to meet new friends, broaden their knowledge and of course, win prizes.
Every years, universities can send one or multiple teams to the contest and all universities hope to win prizes. The organizers want to define a rule to award the excellent contestants.
The contest director decided to follow the World Finals policy by having 44 first prizes, 44 second prizes and 44 third prizes. 1212 winners out of more than a hundred teams is also a good proportion to recognize the best students.
Since universities can send multiple teams, we don’t want one university to swept all the awards. Thus, only the top team from a university can be awarded. It seems harsh for the second best team from one university but do not worry, they will still receive relevant certificates.
The table below is the result of top 1010 of Nha Trang Regional Contest 2016. The 44 -th (team WINDOWS) and 88 -th place (team UBUNTU) did not receive prizes because they were not the top team from University of Engineering and Technology - VNU. Team Metis and team BK.DeepMind are in the same situation.
Place | Institution | Team | Prize |
11 | Seoul National University | ACGTeam | First Prize |
22 | University of Engineering and Technology - VNU | LINUX | First Prize |
33 | Shanghai Jiao Tong University | Mjolnir | First Prize |
44 | University of Engineering and Technology - VNU | WINDOWS | |
55 | National Taiwan University | PECaveros | First Prize |
66 | Hanoi University of Science and Technology | BK.Juniors | Second Prize |
77 | Ho Chi Minh City University of Science | HCMUS-Serendipity | Second Prize |
88 | University of Engineering and Technology - VNU | UBUNTU | |
99 | Shanghai Jiao Tong University | Metis | |
1010 | Hanoi University of Science and Technology | BK.DeepMind |
Given the final scoreboard of the contest, your task is to determine which 1212 teams should be awarded prizes.
Input
-
The input starts with the number of teams NN (12≤N≤20012≤N≤200 ).
-
The ii -th line of the next NN lines contains information about the team that ranks ii : the university name and the team name separated by a single space. Both names consists of digits, lowercase and uppercase English alphabet letters only. Both names does not exceed 2020 letters in length.
-
It is guaranteed that there are at least 1212 different universities.
Output
The output should contain 1212 lines describing 1212 winners. In each line, you should print the university name and the team name separated by a single space. The winners should be listed in the same order as the input.
Sample Input 1 | Sample Output 1 | ||||||||
---|---|---|---|---|---|---|---|---|---|
| | ||||||||
A题很简单,一道HASH题即可。
B The tunnels of Cu Chi are an immense network of underground tunnels connecting rooms located in the Cu Chi District of Ho Chi Minh City. The Cu Chi tunnels were the location of several military campaigns in the 1960s. Nowadays, it is a popular tourist destination. There are documents from trusted sources about a private network of tunnels in this area used by a secret forces unit but it has not been discovered. According to the documents, this private network has NN rooms (numbered from 11 to NN ) connected by N−1N−1 bidirectional tunnels. Room 11 is the entry point from the ground surface to this underground network. From room 11 , you can follow the tunnels to go to any of the rooms. The rooms are numbered in such a way that, if you follow the shortest path from room 11 to any room XX , the sequence of visited rooms’ indices will be increasing. The image below shows a valid map of this network. The network below is invalid, since the path from 11 to 44 is 11 - 33 - 22 - 44 , which is not increasing: There is also an old article from an unknown source mentioning about DiDi which is the number of rooms directly connected to room ii . Given an array DD of size NN , your task is to verify if it is possible to have such a network. Input
OutputPrint YES/NO if it is possible/impossible to have such a network, respectively.
贪心题:主要不断加入尽可能小的且能加入的点(度数满足要求),没加入一次,两个点都减少1个度数,并把新的点加入图中(这里用set存图),加入的就map=1,以免下次使用的时候又把这个点加上了:比如第二层是2、3、4,2往下又加上了5、6,但是3往下也可以加5、6,但已经被加上了就不能加了。 最后判断度数是否都为0,中间有些情况可以提前结束判断。 E Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak. There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices k such that: l ≤ k ≤ r and ak = x. His task is to calculate the number of pairs of indicies i, j (1 ≤ i < j ≤ n) such that f(1, i, ai) > f(j, n, aj). Help Pashmak with the test. Input The first line of the input contains an integer n (1 ≤ n ≤ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109). Output Print a single integer — the answer to the problem. Examples Input 7 1 2 1 1 2 2 1 Output 8 Input 3 1 1 1 Output 1 Input 5 1 2 3 4 5 Output 0 E题是一道对我来说的一个总结性很强的题:有单独讲:https://blog.csdn.net/mxYlulu/article/details/81137457 |