Educational Codeforces Round 141 解题报告 \(\text{By DaiRuiChen007}\) \(\text{Contest Link}\) A. Make it Beautiful 所有 \(\{a_i\}\) 相等显然不行,把最大的 \(a_i\) 放最前面,只要第二个和第一个不同就可以随便排了 我这里是用出现次数进行分层,对于出现次数 \(\ge 1,\ge 2,\ge 3,\cdots\) 的值分别逆序排列 时间复杂度 \(\Theta(n\log…
E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rules of Sith Tournament are well known to everyone. n Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who wil…
题目链接: 题目 E. Another Sith Tournament time limit per test2.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output 问题描述 The rules of Sith Tournament are well known to everyone. n Sith take part in the Tournament. The Tour…
比赛链接 A 题意 给一个数组 \(a\) ,要求重排列以后 \(a[i] \neq a[1,i-1]\) ,其中 \(a[1,i-1]\) 是前 \(i-1\) 项和. 如果无解则输出 NO :否则,给出一个合法的重排列后的 \(a\) . 题解 知识点:贪心. 显然先从大到小排序. 若 \(a_1 = a_2\) ,则需要用其他一个数字替换 \(a_1\) ,若此时 \(a[1] = a[n]\) 则没有数字换无解:否则可以交换 \(a_1,a_n\) . 否则,直接输出即可. 时间复杂度…
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file for some programming competition problem. His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually ge…
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L ≤ x ≤ R andx = a1k' + b1 = a2l' + b2, for some integers k', l' ≥ 0. 输入 Th…
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd. 输入 The only line contains odd integer n (1 ≤ n ≤ 49). 输出 Print n lines…
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. 输入 The first line contains integer n (1 ≤ n ≤ 3·105)…
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and dis the row from '1' to '8'. Find the number of moves perm…
Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能出现一次. 策略: 延伸:这里指的延伸如当发现1-1如果以最后出现重叠的数为右边界则就表示左延伸,若以1.0.1..0第二个0前一个位置作为右边界就为右延伸: 开始时想是右延伸,考虑到可能只出现一组两个数相同,认为向左延伸会出错,但是直接WA了之后,发现这并不是题目的坑点(其实只需将最后一组改成左右…