Partial Replacement Solution Codeforces Round #710 Div. 3

You are given a number kk and a string ss of length nn, consisting of the characters ‘.’ and ‘*’. You want to replace some of the ‘*’ characters with ‘x’ characters so that the following conditions are met: The first character ‘*’ in the original string should be replaced with ‘x’; The last character ‘*’ in the original string … Read more

Strange Table Solution Codeforces Round #710 Div. 3

Strange Table solution Codeforces Round #710 Div. 3 Polycarp found a rectangular table consisting of nn rows and mm columns. He noticed that each cell of the table has its number, obtained by the following algorithm “by columns”: cells are numbered starting from one; cells are numbered from left to right by columns, and inside each column from top to … Read more

K-Goodness String Google Kickstart Solution Round 1

Problem Charles defines the goodness score of a string as the number of indices ii such that Si≠SN−i+1Si≠SN−i+1 where 1≤i≤N/21≤i≤N/2 (11-indexed). For example, the string CABABC has a goodness score of 22 since S2≠S5S2≠S5 and S3≠S4S3≠S4. Charles gave Ada a string SS of length NN, consisting of uppercase letters and asked her to convert it into a string with a goodness score of KK. In one operation, Ada can change any character … Read more

Prison Break Codeforces Round #709 Div. 2 Solution

Prison Break solution codeforces Michael is accused of violating the social distancing rules and creating a risk of spreading coronavirus. He is now sent to prison. Luckily, Michael knows exactly what the prison looks like from the inside, especially since it’s very simple. The prison can be represented as a rectangle a×ba×b which is divided into abab cells, each … Read more

Playlist Codeforces Round #709 Div. 2 Solution

Playlist solution codeforces Arkady has a playlist that initially consists of nn songs, numerated from 11 to nn in the order they appear in the playlist. Arkady starts listening to the songs in the playlist one by one, starting from song 11. The playlist is cycled, i. e. after listening to the last song, Arkady will continue listening from the beginning. Each song … Read more

Basic Diplomacy Codeforces Round #709 Div. 2 Solution

Basic Diplomacy solution codeforces Question: Aleksey has nn friends. He is also on a vacation right now, so he has mm days to play this new viral cooperative game! But since it’s cooperative, Aleksey will need one teammate in each of these mm days. On each of these days some friends will be available for playing, and all others will not. … Read more

Useful Edges Codeforces Round #709 Div. 2 Solution

Useful Edges Codeforces Solution You are given a weighted undirected graph on nn vertices along with qq triples (u,v,l)(u,v,l), where in each triple uu and vv are vertices and ll is a positive integer. An edge ee is called useful if there is at least one triple (u,v,l)(u,v,l) and a path (not necessarily simple) with the following properties: Useful Edges solution codeforces uu and vv are the endpoints of this path, ee is one of the … Read more

Checksum Solution kickstart 2021

Hello everyone welcome to www.techinfodiaries.com Checksum Solution kickstart 2021 Problem Grace and Edsger are constructing a N×NN×N boolean matrix AA. The element in ii-th row and jj-th column is represented by Ai,jAi,j. They decide to note down the checksum (defined as bitwise XOR of given list of elements) along each row and column. Checksum of ii-th row is represented as RiRi. Checksum of jj-th … Read more

L Shaped Plots solution kickstart 2021

Hello everyone welcome to www.techinfodiaries.com L Shaped Plots solution kickstart 2021 Problem Given a grid of RR rows and CC columns each cell in the grid is either 00 or 11. A segment is a nonempty sequence of consecutive cells such that all cells are in the same row or the same column. We define the length of a segment as number … Read more