2020 ICPC Universidad Nacional de Colombia Programming Contest A. Approach 三分 显然答案可以三分,注意\(eps\)还有两条线平行的情况 view code #include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O2") double dis2(double ox, double oy, double ex, doubl…
C. Common Subsequence 题意:给出长度为n两个串,求两个串的最长公共子序列len,如果len>=0.99*n,两个串就是亲兄弟否则不是. 解法:朴素的求LCS的时间复杂度是O(nm),这题肯定超时.正解不容易想,要注意到0.99这个特点,我们从这个特点下手也就是说最多只能抛弃0.01*n=1000个字符, 那么我们设dp[i][j]为A串前i+dp[i][j]个字符抛弃掉i个字符,B串前j+dp[i][j]个字符抛弃掉j个字符获得的LCS长度为dp[i][j]. 那么对于此时…
Tamref love random numbers, but he hates recurrent relations, Tamref thinks that mainstream random generators like the linear congruent generator suck. That's why he decided to invent his own random generator. As any reasonable competitive programmer…
D. Wildest Dreams 这道题的意思是Ayna和Arup两人会同时在车上一段时间,在Ayna在的时候,必须单曲循环Ayna喜欢的歌,偶数段Ayna下车,若此时已经放了她喜欢的那首歌,就要将它放完,然后按照顺序播放其他的歌,输出一共播放了Ayna喜欢的歌多少分钟. 分情况考虑,加起来总和就是一共播放的时间. 做题思路: 一:奇数段的时间总和: 二:判断奇数段的时间Ayna喜欢的歌是否恰好播放完: (1)若恰好播放完,对其后的偶数段不做处理 (2)若否,判断偶数段时间是否大于此歌未播放部…
M-SOLUTIONS Programming Contest 2020 题解 目录 M-SOLUTIONS Programming Contest 2020 题解 A - Kyu in AtCoder B - Magic 2 C - Marks D - Road to Millionaire E - M's Solution F - Air Safety 题目质量好高啊,做完感觉好难涨智商了诶.(除了某一道程序又臭又长的F) A - Kyu in AtCoder 我们可以放很多个if来判断,但…
A - Airport Coffee 留坑. B - Best Relay Team 枚举首棒 #include <bits/stdc++.h> using namespace std; #define N 510 #define INF 0x3f3f3f3f struct node { string name; double v1, v2; inline void scan() { cin >> name >> v1 >> v2; } inline boo…
$$2017-2018\ ACM-ICPC\ Latin\ American\ Regional\ Programming\ Contest$$ \(A.Arranging\ tiles\) \(B.Buggy\ ICPC\) 分元音位置情况和数量讨论,没有元音答案是1,如果有元音但不在第一个位置上是无法构造出来的,然后其他情况找到最初始的情况的辅音数量即可 //#pragma comment(linker, "/STACK:1024000000,1024000000") #inclu…
\(2019-2020\ ACM-ICPC\ Brazil\ Subregional\ Programming\ Contest\) \(A.Artwork\) 并查集,把检测区域能在一起的检测器放在一个并查集里,然后判断是否有一个集合能够封住左边和上边的其中一个还有右边和下边的其中一个即可 //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using name…
    Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and made an amazing discovery: there are only 16 types of programming contest problems! Furthermore, the top several comprise almost 80% of the problems s…
偏方记录背包里的物品.....每个背包的价值+0.01 Happy Programming Contest Time Limit: 2 Seconds      Memory Limit: 65536 KB In Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the cont…
Happy Programming Contest  ZOJ3703 老实说:题目意思没看懂...(希望路过的大神指点) 最后那个the total penalty time是什么意思啊!!! 还是学到点东西的... 解题的关键在于:要控制最后所用的时间最少,所以在程序的最开始应该先将输入的各种题目 以时间升序排列, 然后就可以保证每次都以时间小的优先选, 这样就可以保证最后相同的吸引值和解题数的情况下所花的时间最少. #include <iostream> #include <stdi…
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 429    Accepted Submission(s): 244 Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial Collegiate Programming Contest - K Capture the Flag Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge In computer security, Capture…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial Collegiate Programming Contest - B Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programming contest, Edward, the…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial Collegiate Programming Contest - D Beauty of Array Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward has an array A with N integers. He defines…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial Collegiate Programming Contest - G Lunch Time Time Limit: 2 Seconds      Memory Limit: 65536 KB The 999th Zhejiang Provincial Collegiate Programming C…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial Collegiate Programming Contest - J Convert QWERTY to Dvorak Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, a poor copy typist, is a user o…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial Collegiate Programming Contest - H May Day Holiday Time Limit: 2 Seconds      Memory Limit: 65536 KB As a university advocating self-learning and work…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5504  The 12th Zhejiang Provincial Collegiate Programming Contest - L Demacia of the Ancients Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a popular multiplayer online ba…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 The 12th Zhejiang Provincial Collegiate Programming Contest - A Ace of Aces Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a mysterious organization called Time-Space…
2016 Sichuan Province Programming Contest 代码 2016 Sichuan Province Programming Contest A. Nearest Neighbor Search \(dx\)根据\(x_0\)与\([x_1, x_2]\)位置考虑. \(dx.dy.dz\)单独考虑. B. Odd Discount 做法一:对于两个不同优惠\((i,j)\),所有方案中与两个优惠商品交集为奇数,即同时取到两种优惠的个数为\(2^{n-2}\)种.…
2016 Hunan Province Programming Contest A. 2016 题意 \(1 \le a \le n, 1 \le b \le m\) ,其中\(1 \le n,m \le 10^9\) 求正整数\((a,b)\)对的数量,满足\(ab \% 2016 = 0\) 思路 \(2016=2^53^27\) 根据\(a\)对因子的贡献对\(a\)分类,每种方案数对应\(b\)的数量,即\[\lfloor \frac{m}{\frac{2016}{a}} \rfloor…
Problem A Almost Palindrome Given a line of text, find the longest almost-palindrome substring. A string S is almost-palindrome if S begins and ends with a letter, and a(S) and b(S) have at most 2k positions with different characters Here a(S) is the…
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roads. The funny part is: each road is open and closed periodically. Each road is associate with two integers (a, b), that means the road will be open fo…
Problem H High bridge, low bridge Q: There are one high bridge and one low bridge across the river. The river has flooded twice, why the high bridge is flooded twice but the low bridge is flooded only once? A: Because the lower bridge is so low that…
Problem I Interesting Calculator There is an interesting calculator. It has 3 rows of button. Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of the display. Row 2: button +0, +1, +2, +3, ..., +9. Pressing each bu…
Problem J Joking with Fermat's Last Theorem Fermat's Last Theorem: no three positive integers a, b, and c can satisfy the equation an + bn = cn for any integer value of n greater than two. From the theorem, we know that a3 + b3 = c3 has no positive i…
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student names. However, there are too many students, so I failed. It is a shame, so I don't want my students to know this. Whenever I need to call someone, I c…
Problem L Last Blood In many programming contests, special prizes are given to teams who solved a particular problem first. We call the first accepted solution "First Blood". It's an interesting idea to set prizes for "Last Blood". The…
Problem C Character Recognition? Write a program that recognizes characters. Don't worry, because you only need to recognize three digits: 1, 2 and 3. Here they are: .*. *** *** .*. ..* ..* .*. *** *** .*. *.. ..* .*. *** *** Input The input contains…