Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### HolkinPV's blog

By HolkinPV, 9 years ago, translation, ,
Good morning, day, evening, night to you.

Welcome to the wonderful randomized contest, which is prepared for you by team Saratov SU 3 (Davtyan Edvard, Kholkin Pavel, Kudryashov Igor).

Thanks to Julia Satushina, Artem Rakhov and Dmitry Matov for their help in preparing this round. Special thanks to VK company.

Good luck and high rating!
With best regards, Saratov SU 3.

• +41

 9 years ago, # |   +1 Is a tutorial available for this contest?//It's funny! I know how to solve all problems except B!
•  9 years ago, # ^ |   0 I didn't participate, but just read B. Did you understand it as, 'we need to change all occurrences of c1 to c2 ? '. Its just one character change at a time. First thought is.. a simple Floyd on 26x26 matrix to find cost[x][y] -> minimum cost to make x & y characters same. I hope this works.
•  9 years ago, # ^ |   0 I also thought that but I think we need to verify if we can transform A -> X, B->X if cost[a][x] + cost[b][x] is less than cost[a][b].
•  9 years ago, # ^ | ← Rev. 6 →   0 I also want to know the spected solution for problem B.I did a Floyd-Warshall from all letters to have the minimum cost for each pair, then for each char C in the first word and D in the second word I take the min(graph[C][k] + graph[D][k]), k being all letters from 'a' to 'z'.What is wrong in this idea?---Fixing: I am sorry, my problem was Accepted in the contest. I thought I won a "wrong answer" but it was correct.
•  9 years ago, # ^ |   0 You probably mean min(graph[C][k], graph[D][k]).
•  9 years ago, # ^ |   0 Yes! You got it.
•  9 years ago, # ^ |   0 i did it the same way.  but on pretest 7 it fails i cant' get what's my problem here is my pseudocode.if (length1!=...2) print -1;for (i=0;i
•  9 years ago, # ^ |   0 Replace 200 with something larger. The minimum path length may be upto 100*25
 9 years ago, # |   0 I got a presentation error on problem B for test 38. Can someone tell me why?I have used a combination of printf and cout. Will that be a problem?
 9 years ago, # |   0 What's the test case 16 of problem C...
 9 years ago, # |   0 On problem B what is the expected answer for the input:aaaabbbb4a b 1a b 2a b 3a b 4is it:4bbbbor10bbbb
•  9 years ago, # ^ |   0 4bbbb
 9 years ago, # |   0 What is the test input data of test 5 (problem C)?
•  9 years ago, # ^ |   0 "sorry",,, i found my bug :D
 9 years ago, # |   0 On problem B,I have used :// in the main functionif(strlen(sa)!=strlen(sb)){       puts("-1");       return -1;}Unfortunately, my code is always getting Runtime Error for test 3.However, if  "return 0" replace "return -1", I get Accepted.Why?sorry for my poor English!Thanks!
•  9 years ago, # ^ |   +7 You must always return in main function 0, and write anwer in console\file, because if you return non-zero value in main function, test system may think that you program crash with runtime error.
•  9 years ago, # ^ |   0 Thank you ! I see! But I think it isn't reasonable. Even I is always
 9 years ago, # |   0 What's the test case 26 of problem B ?My solution is timing out on that.
 9 years ago, # | ← Rev. 2 →   +8 K (the number of queries) in problem D can be larger.In that case, O(MK) solution will get TLE, and problem D can be a bit harder to get accepted.
 9 years ago, # |   0 I noticed some of the scores are shown in blue after the final tests. Any ideas what does it mean?
 9 years ago, # |   0 Can anyone plzz tell what problem c meant .. i couldnt understand it ..:(thanks in advance
•  9 years ago, # ^ |   0 I can't understand it too!
•  9 years ago, # ^ |   0 Give you a sequence with integers,choice one prefix and one stuffix (each of them maybe empty) to make the sum of the sequence MAXIMUM by mult each of the prefix and stuffix s element with -1; Print the maxSum;PS: Sorry for my poor English...
•  9 years ago, # ^ |   0 plzz explain with a test case..
•  9 years ago, # ^ |   0 you are given a sequence, you take a prefix and suffix. for all numbers in the prefix and suffix, for  multiply all numbers in prefix and suffix by -1. so for test case:3-1 -2 -3there are many possible answers:(1) -1 -2 -3 sum= -6 (here the prefix is empty and suffix is empty)(2) -1 -2 3 sum=0 (here the prefix is empty and suffix is {-3}, multiply by -1 become  {3}) (3) -1 2 3 sum=4 (here the prefix is empty and suffix is {-2 -3}, multiply by -1 become { 2 3} )(4) 1 2 3 sum=6 (this is the maximum possible answer, prefix is empty and suffix is {-1 -2 -3} multiply by -1 become {1 2 3})etc
•  9 years ago, # ^ |   0 typo:*for all numbers in the prefix and suffix,  multiply all numbers in prefix and suffix by -1. so for test case:
 9 years ago, # |   0 During the contest I coded wrong solution for B in Java, I didn't analyze the problem very well, but after the contest I tried the problem with the right solution in Java. I got Time Limit Exceeded. I tried every possible optimization in order to pass the test 26, but I couldn't manage it. I guess the reading input was taking the longest time. I usedBufferedReader br = new BufferedReader(new InputStreamReader(System.in);Also, I tried reading the string byte after byte with using only InputStreamReader, but it was still TLE...In the end I just copied my code in c++, changed some syntax in order to work with c++ and I got Accepted.The thing I like to ask is whether some more experienced Java coder can tell me what is the most efficient reading input structure to use. I saw that there are accepted solutions in Java so every hint is welcomed.Thank you in advance.
•  9 years ago, # ^ |   +1 I had a similar problem as your's ::Hope that this help :http://codeforces.com/blog/entry/735
•  9 years ago, # ^ |   0 Yes, it works by using StringBuilder!Thanks a lot!
 9 years ago, # |   0 Hi! I did problem D but with a rather difficult solution. Can someone give me his/her solution or the official solution?
•  9 years ago, # ^ | ← Rev. 2 →   0 Authors solution . Usually authors write about their solution, you can google it
 9 years ago, # |   0 What is the test case 6 in problem E?Test case 1 in final test of problem E is same as example test 1. Right or wrong?