Codeforces Round #834 Restore the Permutation Solution (Java/C++)

Solution: The whole idea: 1. Sorts b while preserving b's original index.…

Codeforces Round #827 (Div. 4) ABCDEFG Solutions (Java/C++)

A. Sum Solution: After sorting directly, see if the sum of the first two numbers is equal to the third number. Code: Java C++…

Codeforces Round #766 ABCDE Solutions (Java/C++)

A. Not Shading Solution: Obviously if (r, c) is originally black, then output 0. Output 1 if row r or column c is black. Output 2 if black is present. If not even black, output -1.…

Codeforces Round #765 ABC Solutions (Java/C++)

A. Ancient Civilization Solution: Count the number of Xs where each bit is 1. If a bit has more than half of 1's, then y is 1 in that bit, otherwise it's 0.…

Codeforces Round #764 ABCDEFG Solutions (Java/C++)

A. Plus One on the Subset Solution: Obviously, output the maximum value minus the minimum value. Code: Java C++…

Codeforces Round #764 Masha-forgetful Solution (Java/C++)

Solution: Trie + DP。 First, any number greater than 3 can be represented as the sum of 2s and 3s. So we have each of our segments of length either 2 or 3.…

Codeforces Round #763 ABC Solutions (Java/C++)

A. Robot Cleaner Solution: Just simulate the behavior of the robot according to the requirements of the problem. Code: Java C++…

Codeforces Round #762 (Div. 3) ABCDEFG Solutions (Java/C++)

A. Square String? Solution: First, see whether the length of the string can be divisible by 2, and then verify whether the first half and the second half are the same.…