Codeforces Round 650 (Div. 3)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1367 Codeforces Round 650 (Div. 3) FINISHED False 7200 145034711 June 16, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8426 ) D Task On The Board PROGRAMMING constructive algorithms greedy implementation sortings

B'Polycarp wrote on the board a string s containing only lowercase Latin letters ( 'a '- 'z '). This string is known for you and given in the input. After that, he erased some letters from the string s , and he rewrote the remaining letters in any order. As a result, he got some new string t . You have to find it with some additional information. Suppose that the string t has length m and the characters are numbered from left to right from 1 to m . You are given a sequence of m integers: b_1, b_2, ldots, b_m , where b_i is the sum of the distances |i-j| from the index i to all such indices j that t_j > t_i (consider that 'a '< 'b '<...< 'z '). In other words, to calculate b_i , Polycarp finds all such indices j that the index j contains a letter that is later in the alphabet than t_i and sums all the values |i-j| . For example, if t = "abzb", then: Thus, if t = "abzb", then b=[6,1,0,1] . Given the string s and the array b , find any possible string t for which the following two requirements are fulfilled simultaneously: The first line contains an integer q ( 1 <= q <= 100 ) -- the number of test cases in the test. Then q test cases follow. Each test case consists of three lines: It is guaranteed that in each test case an answer exists. Output q lines: the k -th of them should contain the answer (string t ) to the k -th test case. It is guaranteed that an answer to each test case exists. If there are several answers, output any. In the first test case, such strings t are suitable: "aac ', "aab". In the second test case, such trings t are suitable: "a", "b", "c". In the third test case, only the string t equals to "aba" is suitable, but the character 'b ' can be from the second or third position. '...

Tutorials

Codeforces Round #650 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
84024204 Gassa D June 16, 2020, 4:57 p.m. OK D TESTS 7 31 0

remove filters

Back to search problems