By KAN, 3 years ago, translation,

Hi!

On Tuesday, July 11, 2017, at 16:35 UTC Codeforces Round #423 will be held. Some of the problems will be from VK Cup 2017 Finals, some are prepared by Codeforces team to complete the problemset.

Note that there will be two rounds based on VK Cup Finals, so I want to ask finalists not to discuss problems until the end of the second round.

There will be six problems in each division, four of them shared. The problems of this round are proposed, prepared and tested by: gritukan, demon1999, fcspartakm, Perforator, MikeMirzayanov, PavelKunyavskiy, qwerty787788, Belonogov, izban, tourist, vepifanov, AlexFetisov, winger, Errichto, Gassa, naagi, ashmelev, Endagorion, ifsmirnov, Arterm and me. Huge thanks to all who helped with the preparation!

There will be prizes from VK social network in this round! Namely, among participants solved five or more problems in second division, or three or more problems in first division, five are to be selected randomly. They will receive championship souvenirs. There is no country nor language restriction, everyone can win a prize. One don't have to have participated in VK Cup to receive the prize. Exact selection algorithm will be announced before the start of the round. There will be prizes in the second round using Finals' problems as well!

Good luck!

Congratulations to the winners!

Div. 1:

Div. 2:

The analysis is here.

Corresponding problems from VK Cup 2017 - Finals:

The souvenirs winners are:

Eligible list place Contest Rank Handle
19 827 19 zeliboba
42 827 42 kevinsogo
114 827 115 triploblastic
125 827 126 lexuanan
138 827 140 alex256

Congratulations!

• +389

 » 3 years ago, # | ← Rev. 2 →   +77 Thanks for your efforts But how do you make sure that no one of the finalists has leaked the problems ?
•  » » 3 years ago, # ^ |   +152 They trust them and trust is never meant to broken. <3
 » 3 years ago, # | ← Rev. 7 →   -96 Is it rated?
•  » » 3 years ago, # ^ |   +51 no it's not, they wrote the word "rated" as a joke :)
•  » » 3 years ago, # ^ |   +325
•  » » » 3 years ago, # ^ |   +219
•  » » » 3 years ago, # ^ |   +22 OMG, 300+ upvotes on a single comment. I want to thank my parents for bringing me up, my friends who have always supported me in everything I do and everybody who voted for this comment. Also, a huge "Thank you" goes to Mike Mirzayanov, without whom this would not be possible, for creating this awesome platform.
 » 3 years ago, # |   +66 Does souvenirs includes the cute cats?
•  » » 3 years ago, # ^ |   +5 His name is "Persik" (Peach)
 » 3 years ago, # | ← Rev. 2 →   +1 Duration of the rounds? 3 hours, or more?
•  » » 3 years ago, # ^ |   +3 2 h
 » 3 years ago, # |   +63 15 reds
•  » » 3 years ago, # ^ |   +56 It's 16 reds including KAN.
•  » » 3 years ago, # ^ |   +113
•  » » » 3 years ago, # ^ |   -15 Thanks.
•  » » » 3 years ago, # ^ |   +9 Hey man, you are prince of statistics and probability , I always notice your efforts in comments
•  » » » 3 years ago, # ^ |   -10 Thanks.
 » 3 years ago, # |   -63 666
 » 3 years ago, # | ← Rev. 2 →   +36 Wow! the number of problem setters exceeds the number of problems itself. xDIt must be a challenging round.
•  » » 3 years ago, # ^ | ← Rev. 2 →   -8 The problems of this round are proposed, prepared and tested byNot all of them are problem setters. So we can't be sure that the number of setters exceeds the number of problems.
 » 3 years ago, # | ← Rev. 3 →   -35 The start time is too late
•  » » 3 years ago, # ^ |   -10
•  » » » 3 years ago, # ^ |   +8 In China，It‘s midnight。 So .... T_T
•  » » » » 3 years ago, # ^ |   0 It is always less than 30 minutes from midnight somewhere.
 » 3 years ago, # | ← Rev. 3 →   -82 Okey, who wants to receive championship souvenirs, put dislike!
 » 3 years ago, # |   0 Codeforces server seems awfully slow. Does anyone know what is the matter with vjudge1 , vjudge2 and so on. There is a huge number of submission from these ids.
•  » » 3 years ago, # ^ |   +11 Well, vjudge(.) accounts are used to submit solutions from VirtualJudge and there are not so many submissions to hack codeforces. However I worry that there can be problems with codeforces during the contest and also API is not working which I use participating in the contests(
 » 3 years ago, # |   +2 Good luck everyone :D
 » 3 years ago, # |   +8 I got so used to times specified in MSK timezone (which is also more convenient for me) that I thought this one is in MSK too and completely ruined my schedule, oops
•  » » 3 years ago, # ^ |   +27 In the English post it is written explicitly that time is in UTC, isn't it? On the contests page the times are noted with a timezone, right?
•  » » » 3 years ago, # ^ |   0 Yeah I know it's completely my mistake, I was quickly checking it on my phone without paying much attention.
 » 3 years ago, # |   +27 For div 1 contests, will task be same as on official contest, or we will have one easier ?
 » 3 years ago, # |   0 Thx for preparing the contest... GL all coders :) Let's Rock
 » 3 years ago, # | ← Rev. 3 →   -42 .
 » 3 years ago, # |   0 With all due respect to all problem setters and testers... I don't know why but seeing 'tourist' in the list gives a different feeling whole together..!!! Seems to be an awesome contest on it's way !
 » 3 years ago, # |   0 delay :)))
 » 3 years ago, # |   0 10 minute delay? :(
 » 3 years ago, # |   +4 And again delayed...
 » 3 years ago, # |   +52 I think winner of div 2 will be ccz181078 :)
•  » » 3 years ago, # ^ |   0 mind explaining how you make that prediction?
•  » » » 3 years ago, # ^ |   +19 https://www.codechef.com/rankings/JULY17hahahhahhahaha, this is the reason for my prediction :)
•  » » 3 years ago, # ^ |   +6 OMG! :D
•  » » 3 years ago, # ^ |   0 your prediction was correct...
•  » » » 3 years ago, # ^ |   0 Thanks "L" ;P
 » 3 years ago, # |   +20
 » 3 years ago, # | ← Rev. 2 →   0 delay------10 minute.
 » 3 years ago, # |   +21 I have a feeling that Div2 result will mostly be decided by the speed of solving the first 2 problems.
•  » » 3 years ago, # ^ |   +2 If added 3 new problems A,B,C it will not be decided.
•  » » 3 years ago, # ^ |   +11 Oh boy, you have never been so wrong your whole life!
 » 3 years ago, # |   +59 You know what's worse than being in the friendzone for long? Being in the gray zone after a ton of contests. :(Hoping to change that in this round. Need +40. Good luck to me! Good luck to everyone! :)
•  » » 3 years ago, # ^ |   +10 Never say Never http://codeforces.com/profile/KingOfWrongAnswer
•  » » 3 years ago, # ^ | ← Rev. 2 →   +19 Oh you got it, @cpaudyal! So happy for you. Keep up the good work.
 » 3 years ago, # |   +10 Where is the scoring distribution?
 » 3 years ago, # |   +52 To determine the winners we will use the following algorithm. List all participants from div. 1 who solved at least three problems from top to bottom of the standings, ties broken by the time of last AC. List all participants from div. 2 who solved at least five problems from top to bottom of the standings, ties broken by the time of last AC. Append the second list to the back of the first list. Use the following code to generate the indices of the winners in the resulting list. The seed is the score of first place in the next div. 1 contest. The length is the length of the list. code#include "testlib.h" #include using namespace std; int main() { rnd.setSeed(); set winners; while (winners.size() < 5) winners.insert(rnd.next(1, )); for (auto winner: winners) cout << winner << " "; cout << endl; return 0; } 
•  » » 3 years ago, # ^ |   0 "The seed is the score of first place in the next div. 1 contest."I can see people in the next contest posponing their submissions by few minutes and intentionally unsuccessfully hacking just to get a more favourable seed.
•  » » 3 years ago, # ^ |   +20 And? Who won? :D
•  » » » 3 years ago, # ^ |   +31 With seed 5581, 200 people with 3+ problems in div1, 13 people with 5+ problems in div2 (isn't that difference too big?), the winners are places 19, 42, 115, 127, 139 in div1: zeliboba kevinsogo triploblastic soimae pitfall
• »
»
3 years ago, # ^ |
Rev. 3   +20

I wrote some scripts to make the process of winners determining easier, and they produce results slightly different then Xellos's. Here are my results (not official yet):

List place Contest Rank Name
19 827 19 zeliboba
42 827 42 kevinsogo
114 827 115 triploblastic
125 827 126 lexuanan
138 827 140 alex256

The seed is 5581, the length is 213. The output of the generator is 19 42 114 125 138. The scripts I used are below. Xellos, have you used any scripts? If so, can you see where the difference came from?

python code
c++ code
•  » » » 3 years ago, # ^ |   0 The list places are the same for me. I didn't use scripts, just went through the scoreboards manually, marked off ineligibles and then added 1 to list places for each smaller ineligible place; maybe I added incorrectly for place 131.
•  » » » 3 years ago, # ^ |   0 I believe that my results are correct, so now they're official.If anyone has comments about the code, please comment.
 » 3 years ago, # |   -24 what will be my contribution if i ask is it rated? and what the hell of lating?
 » 3 years ago, # |   +31 This contest has more hacks than the U.S. presidential election!
•  » » 3 years ago, # ^ |   +20 maybe because of the large number of russians here :p
 » 3 years ago, # |   0 Is there anyone easier way to do E than FFT?
•  » » 3 years ago, # ^ |   0 I also use FFT
•  » » 3 years ago, # ^ |   0 What is FFT? Could you explain it please, if it's not too long, or give a good reference to it?
•  » » » 3 years ago, # ^ |   +3
•  » » » » 3 years ago, # ^ |   +5 Thank you.
•  » » » 3 years ago, # ^ | ← Rev. 3 →   +12 It's an algorithm used to multiply two polynomial in O(nlogn) (with n is the degree of the polynomial). You can learn more about it here. (This is probably the only resource so far that don't make me instantly want to give up trying to learn this algorithm)
•  » » » » 3 years ago, # ^ |   +5 Thank you.
•  » » 3 years ago, # ^ | ← Rev. 2 →   +2 I did 400 Binary Index Trees, but I dont know if that qualifies as easier ;) edit: nvm you meant div 1, I meant div 2
•  » » » 3 years ago, # ^ |   +3 I think he means div 1. E
 » 3 years ago, # |   +1 Easy div.2 A hacks
•  » » 3 years ago, # ^ |   0 How can i hack other's code ?
•  » » » 3 years ago, # ^ |   0 You need to lock this problem firstly(problems page), then you can open other's code (room page, double left click / ctrl + click on their score on problem) , look through and try to hack (button will be at the end of code).
•  » » » » 3 years ago, # ^ |   0 There are no constraints? e.g. rating only lock?
•  » » » » » 3 years ago, # ^ |   0 You can lock only task you have already solved(solution has passed pretests) and you cannot send any code on this problem after lock.
•  » » » » » » 3 years ago, # ^ |   0 Really really thanks!!
 » 3 years ago, # | ← Rev. 3 →   0 4 1 21 1 1 2 Ez hacks :) P.S.: Sorry, room 125 ^_^
•  » » 3 years ago, # ^ |   +3 Answer is 2 right?
•  » » » 3 years ago, # ^ |   0 yep
•  » » » » 3 years ago, # ^ |   0 why 2 ? i thpught the answer is 0
•  » » » » » 3 years ago, # ^ |   0 If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. If there are none of them, it is seated at a two-seater table occupied by single person. If there are still none of them, the restaurant denies service to this group.
•  » » » » » » 3 years ago, # ^ |   0 Got it thanks
•  » » 3 years ago, # ^ |   +8 Hacked is better than system testing failed
 » 3 years ago, # |   +14 WA on pretest 11 on Div2 D. What could be this case?
•  » » 3 years ago, # ^ |   0 7 3My code was giving wrong answer on this test case and I also got WA on pretest 11.
 » 3 years ago, # |   +3 Div2A Hack4 1 21 1 1 2Answer — 2PS — My solution will also fail. :)
•  » » 3 years ago, # ^ |   0 how is it 2? the first one will take an a table, the next 2 a b table and the last 2 the last b table. isn't this right?
•  » » » 3 years ago, # ^ |   0 I assumed the same but..If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. If there are none of them, it is seated at a two-seater table occupied by single person.
•  » » » » 3 years ago, # ^ |   +7 oh god, i understand now lol. that restaurant has some stupid policies.
•  » » » » » 3 years ago, # ^ |   +3 Could it be said that the pretests were very weak?
•  » » » » » » 3 years ago, # ^ | ← Rev. 2 →   0 the pretests were fine. if i had wa i would have wasted too much time trying to debug, not realizing that i understood the statement wrongly.
•  » » 3 years ago, # ^ |   0 I think very many solutions falls in this test, me too...
 » 3 years ago, # |   +8 Is the hack for C TLE ???If so I'm screwed.
•  » » 3 years ago, # ^ |   0 Yeah same here, thanks to map
•  » » » 3 years ago, # ^ |   0 Goddamn it the code was ready I was just about to resubmit it...Ah well...
 » 3 years ago, # |   +6 Hack for C div2 or A div1?
 » 3 years ago, # |   +30 people were hacking faster than eminem rapping
 » 3 years ago, # |   +8 TC 11 for DIV2 D any idea?
•  » » 3 years ago, # ^ |   +8 Don't know if it's that, but check for 13 6, answer is 4.
•  » » 3 years ago, # ^ | ← Rev. 2 →   +17 may be it was 8 3what i think it was 2 6 \ / 3 5 \ / 1 | 7 | 8 | 4 and not like 1-2-3-4-5-6-7 | 8 
•  » » » 3 years ago, # ^ |   0 Nope, I got WA 11 but I output 5 on this
•  » » » » 3 years ago, # ^ |   0 That is why I wrote may be!! but after working on this my pretests were passed
 » 3 years ago, # |   0 How to solve E?
 » 3 years ago, # |   +42 After a really bad performance on A and B...I know if I continue to do this contest, as usual, I am definitely not going to get a good result, so I opened F. I did F for more than one hour and I didn't pass pretest 19 until the contest ended.
•  » » 3 years ago, # ^ |   +31 Why even bother with A and B? You can start with F straightaway :D Yes, this strategy might not give you the best result, but at least you will spend the contest solving an interesting problem.
 » 3 years ago, # |   +22 When you cannot debug a simple FFT solution for 1 hour :'(
•  » » 3 years ago, # ^ |   +191
•  » » » 3 years ago, # ^ |   +18 xD xD xD
 » 3 years ago, # |   +1 4 1 2 1 1 1 2Hack test in problem A :D :D Good Luck all :D
 » 3 years ago, # |   0 What is the hack for Div2C?
 » 3 years ago, # |   0 How to solve Div 2 D? And is Div2 E just a simple segment tree that remembers for every letter and every position % 10 number of occurences on every prefix?
•  » » 3 years ago, # ^ | ← Rev. 2 →   +8 I solved Div2E nearly the same way you described and used bit instead of segment tree.
•  » » » 3 years ago, # ^ |   0 I figured out the same solution, didn't get time though. :/
•  » » » 3 years ago, # ^ |   0 Looks like you can store prefix sums as well. Although I haven't submitted yet.
•  » » 3 years ago, # ^ |   0 From one node, the other nodes extend in k directions. like a bfs.
•  » » » 3 years ago, # ^ |   0 Just like that? So simple? Any ideas how to prove that?
•  » » 3 years ago, # ^ |   0 tried the same, but got mle. i suck at implementing seg trees.
•  » » 3 years ago, # ^ | ← Rev. 3 →   +5 For Div2D.The tree wil be of star shape. So, put k vertices around centre. Keep doing this until you have less than k vertices. Then, put each of the remaining vertices in each of the branch. Maximum distance is 2*floor(n-1/k) in case when n-1%k==0 2*floor(n-1/k)+1 in case when n-1%k==1 2*floor(n-1/k)+2 in case when n-1%k>1
•  » » » 3 years ago, # ^ |   0 How do you prove (even intuition behind that) that a star tree generates the lowest diameter?
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   0 Followin is just an attempt to prove. Correct me if I am wrong.CASE: n > 2kWe can prove this by induction.Let's say we know the best tree consisting of n - k vertices and k leaf nodes. So, our required tree will be formed by adding k vertices to the best tree consisting of n - k vertices and k leaf nodes , one at each of the k leaves.CASE: n <  = 2k (This is base case)We can clearly see that in this case it will be star. Any other shape of tree yeilds greater diameter.
•  » » » » » 3 years ago, # ^ |   0 The proof is pretty gappy. You don't prove that in the first case, there can't be a better solution. Also, when using induction in graphs, most times it's more efficient to go backwards, inspect a graph, take away a node/edge, and by knowing the statement was true for the previous graph, it can be shown, that it is for the current graph also.If you use the induction forward, there will be troubles to proove that you can achieve any graph this way.
•  » » » » 3 years ago, # ^ |   +18 There can't be a node with higher degree than k, because if a node had more edges, then the network would have more than k exit nodes.Let's assume the highest degree is smaller than k. Pick the highest degree node, and choose the two longest "branches" starting from it. At the end of these "branches" there has to be an exit node. If we would have a node instead of this one, with degree of k, then this two longest "branch" would be at most as long as it is now, because all the non-exit nodes, can be distributed into more parts.Also with this change, other lengths won't be longer, because it can be seen easily, that the longest path in this new network must go through the centre of the "star".In conclusion, the star network isn't worse than any other, hence it's one of the optimals.
 » 3 years ago, # |   +12 I found D easier than C in the contest.
 » 3 years ago, # |   0 Hack for C div2 or A div1????
 » 3 years ago, # |   +14 Only 250points difference between C and D? Really?...
 » 3 years ago, # | ← Rev. 2 →   +35 This was a CF round for me :D
 » 3 years ago, # |   0 Also div2 A hack: 5 1 2 1 1 1 1 1It worked, if somebody didn't count the number of split tables, just used a boolean.
 » 3 years ago, # |   0 I tried to hack Div2 C for TLE. So I tried hack through generated input, then spammed some large string and same index. I care that sum of the size of the strings are equal to 10^6 and sum of k values are equal to 10^6 but I got invalid input with this error "Validator 'val.exe' returns exit code 3 [FAIL Expected EOLN (stdin)]". What is the possible reason?If anyone succeded to hack via generated input, can they show their generation code?
•  » » 3 years ago, # ^ |   +16 You forgot to output newline somewhere
•  » » » 3 years ago, # ^ |   0 So sorry to bother you again, can anyone find the mistake? Here is the generation code. using namespace std; #define PB push_back #define MP make_pair typedef long long int ll; int main(){ std::ios::sync_with_stdio(false); cout<<1000<
•  » » » » 3 years ago, # ^ |   +8 You mustn't output " " at the end of the line.
 » 3 years ago, # |   -8 Div1 C memory limit too strict ???
•  » » 3 years ago, # ^ |   0 Yup :( I just changed vector > to vector and string[MAX] and it passed. How to check difference in memory in this case?
•  » » » 3 years ago, # ^ |   0 I changer my segtree size from maxn*4 to maxn*3 and it passed damn
 » 3 years ago, # | ← Rev. 2 →   0 What was that rogue test case in problem A Div 2 that many people missed?
•  » » 3 years ago, # ^ |   +4 4 1 21 1 1 2
 » 3 years ago, # |   0 in Div2 B if all the cells are black the solution will be -1 or 0 ?
•  » » 3 years ago, # ^ |   +3 if n==m than 0 otherwise -1
•  » » » 3 years ago, # ^ |   0 that's right because the square should contains all black cells I forgot that . thanks a lot
•  » » 3 years ago, # ^ |   +1 if n==m then print(0) else print(-1)
 » 3 years ago, # |   0 div-2 A 5 1 3 1 1 1 2 2 i have hacked the code of user doyenne his code gives 2 as a answer for above TC. but correct answer is 0 for above TC. some body please help me out ?? why
•  » » 3 years ago, # ^ |   0 TC n=5, a=1,b=3, t[]=[1 1 1 2 2]
•  » » 3 years ago, # ^ |   +1 ans is 2 bcoz first 3 group will occupy different tables as given in question than there will be only 1 table left for the 2 sized groups
 » 3 years ago, # |   +13 pretest 7 in E was an antitest for doing fft mod 2^27*3*5+1? Or did i make some stupid mistake?
 » 3 years ago, # |   -8 System test is started...
 » 3 years ago, # |   +30 Waiting for System Testing is like waiting for your HIV testing results...
 » 3 years ago, # |   +2 That feeling, when you couldn't solve task during contest and solved it for 6 minutes after contest
 » 3 years ago, # |   -21
 » 3 years ago, # | ← Rev. 2 →   +37 Div 2 A
•  » » 3 years ago, # ^ |   0 Yep, that's my hacking! My RoomMy hack tests: 4 1 2 1 1 1 2 ANS: 2 5 1 3 1 1 1 1 2 ANS: 2
•  » » » 3 years ago, # ^ |   0 Your first hack test is the same as mine.
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 Can you explain, why the answer is 2?UPD: my fault
 » 3 years ago, # |   +18 test 8 in Div2 C :))))
•  » » 3 years ago, # ^ |   0 It's damned!! You know
 » 3 years ago, # |   0 such shitty pretests for div2C
 » 3 years ago, # |   +1 The contest is a massacre for any problem solver XD WOW
 » 3 years ago, # |   +7 Memory Limit Exceeded on test 8 in Div2 C :(
•  » » 3 years ago, # ^ |   +8 If I understand the statement well, you can have a string of length 106 (e.g. aaaa...aaa) and then 106 positions for this string : 1, 2, 3, ..., 106. Maybe in this case you register 106 times a string of size 106 ?
•  » » » 3 years ago, # ^ |   0 yes. i was pushing the string to each of such indexes. Instead of pushing, could have just stored the max. length string for each index. (instead of creating a vector of string, sorting it and picking the last one. :P)
 » 3 years ago, # | ← Rev. 2 →   -53 Very funny. Write some complicated statement in d2 C/d1 A. Do not add appropriate pretest and watch majority of the solutions fail. Did you guys bring enough popcorn?Edit. Some people still don't know. The strings coincide, so the total amount of occurences can be huge, you should set each letter only once...
•  » » 3 years ago, # ^ | ← Rev. 3 →   +93 Sorry, are you complaining about the fact that a solution that is obviously too slow gets TLE?
•  » » » 3 years ago, # ^ |   -33 I'm complaining that it was not obviously too slow. It is the fact that you can't discuss as majority of submitted solutions failed.
•  » » » » 3 years ago, # ^ |   +57 Copying strings of length 105 from 106 different positions gives 1011 operations. What is not obvious about that?
•  » » » » » 3 years ago, # ^ | ← Rev. 2 →   -40 The fact that they can overlap. It was mentioned that they can coincide — I understood that they can have some common parts but not that the positions may overlap.The statement was not clear — perhaps examples showed that problem but it should not be required to read them to understand the task or at least it should be mentioned that "be careful, statement is not too good, read the examples". Besides it was not clarified what does it mean to be lexicographically minimal.Bottom line is — the statement was confusing which was proven by very high rate of unsuccessful submissions.
•  » » » » » » 3 years ago, # ^ | ← Rev. 2 →   +18 You're just grasping straws. If you made the assumption that strings cannot overlap you cannot blame that on the statement not explicitly mentioning it.
•  » » » » » » 3 years ago, # ^ | ← Rev. 4 →   +31 The statement doesn't say that they don't overlap. Thus, they may overlap. I don't see what can be unclear about it.P.S. The only thing a high rate of failed submission means that (surprise!) a lot of people submitted an incorrect solution. These solutions are blatantly wrong, it's not a corner case or something.
•  » » 3 years ago, # ^ |   0 i do, but still TLE... I'm curious.
•  » » » 3 years ago, # ^ |   +3 Probably java.
•  » » » » 3 years ago, # ^ |   0 Yes, and I used my own SortedMap implementation, which made the code about 2x slower than when using the standard TreeMap implementation. Still O(nlogn), pity that it was rejected.
•  » » » » » 3 years ago, # ^ |   +4 I can confirm java is probably the problem. I translated my Java solution that failed systests into C++ and I got AC. It's annoying that problem-setters often seem to make bounds that are very unfavorable to java users, but understandable considering the main focus is on making sure suboptimal C++ solutions to not pass. Reference: 28433564 28453400
•  » » » » » » 3 years ago, # ^ |   +4 But there is a linear solution to this problem.
•  » » » » » » » 3 years ago, # ^ |   +1 I get that, but based on the bounds I expected am NlogN to pass in time. Maybe that's because I generally compare 10^8 operations ~ 1 second, which might be more accurate for C++ than Java.
•  » » » » » » » » 3 years ago, # ^ | ← Rev. 2 →   0 I don't get that there's a linear solution to this problem. But, that's why I'm not red and will have to wait for the tutorial...EDIT: Oh, yes, now I see, use an array instead of a (tree)map, that's linear indeed, thanks.
 » 3 years ago, # |   +6 I don't get how my submission to div1A (28436078) can get a TLE... Can anyone help me understanding this? It seems to me that my program does something like 5·106 operations in any case...
•  » » 3 years ago, # ^ | ← Rev. 9 →   0 I was wrong. Deleted.
•  » » 3 years ago, # ^ |   0 The length of the answer can exceed 106. So you have an access violation that changed the loop counter or something like that.
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 but I used array size 2e6+4, still I got tle on test case 8. Any reason for that?
•  » » » 3 years ago, # ^ |   +3 No it's not the problem, I have no access violation.Actually I got it : I wrote s = v[remember[i]] in a loop of size 106, and v[remember[i]] can be a string of length 106. So if I simply erase this and replace s by v[remember[i]] in the next lines, it should get AC... :'(
•  » » 3 years ago, # ^ |   0 same doubt
•  » » 3 years ago, # ^ |   +24 You made the same mistake I did, copying the string each iteration instead of referencing it:s = v[remember[i]];
•  » » » 3 years ago, # ^ |   0 Yes I just figured it out! Thanks :-)
 » 3 years ago, # |   0 When you fail at A and C... Because of edge cases... I failed C because i used constant too low (2*10^6)
 » 3 years ago, # |   +15 Div2C/Div1A how could this pass systest? http://codeforces.com/contest/828/submission/28450333
•  » » 3 years ago, # ^ |   +8 It takes about operations. The worst case is 1000 strings, each of length 1000, and each appearing at 1000 positions that are spaced 1000 apart.
•  » » » 3 years ago, # ^ |   0 guys i still struggling to get AC :( , if someone can help meI got WA on test case 5 and my solution works in O(|Needed String|)Here
 » 3 years ago, # |   +133
 » 3 years ago, # |   0 Did O(m * log2(m)) pass in D?
•  » » 3 years ago, # ^ |   +4 Yes
•  » » » 3 years ago, # ^ |   0 HLD or smaller set to bigger set?
•  » » » » 3 years ago, # ^ |   +25 HLD , i started coding small to large with priority queues but that would be NlogN memory so i switched to HLD at the last moment.
•  » » » » 3 years ago, # ^ |   0 Actually small-to-big works as well; limits aren't too tight.28460132
 » 3 years ago, # |   0 How to solve E div2 ?
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 I built segment tree for each length of e, every position in e, every letter. So it's about 220 segment trees. I didn't use custom allocator, so got TL. But solution with custom allocator gets AC.PS: can somebody explain me better solution?
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 I also did something similar but using a space around 40*N and BIT trees.
•  » » » » 3 years ago, # ^ |   0 ML is not problem. Every adding operation uses O(logn) memory, so it's O((n + q) * logn). My solution used 393 MB  <  512 MB.
•  » » » 3 years ago, # ^ |   0 I didn't use a custom allocator either. But I made sure that when I was looking at length L, my Fenwick trees all had size n / L, maybe that makes a difference. Here is my solution: 28440263
•  » » » » 3 years ago, # ^ |   0 I think because you used arrays you haven't troubles with memory allocation. And I'm not sure, but Fenwick works faster than segment tree
 » 3 years ago, # |   -64 Who wants it to be unrated? XD
 » 3 years ago, # | ← Rev. 3 →   0 For Div 1 A/ Div 2 C, consider the following testcase:4bcc 1 3c 1 5bcbc 1 6cc 1 4The answer should be "bcbccbcbc" but the accepted solutions output is "aabccbcbc". Why so? The question states that there is at least k occurrences of each string!EDIT: My mistake! Interpreted the question wrong!
•  » » 3 years ago, # ^ |   +1 Question also states that you need to print lexicographically smallest string of all possible strings(answers). In that case u can assume that at least k means exactly k and put 'a' at all the remaining positions of string.
 » 3 years ago, # |   +39 Why is rating predictor not working ?
•  » » 3 years ago, # ^ |   +3 Codeforces API down
 » 3 years ago, # | ← Rev. 2 →   0 So why I'm getting TLE? :/ C SOLUTION
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 Try using fast I/O and use pos.insert(pos.end(), i) to insert in the setCodeSource
•  » » » 3 years ago, # ^ |   0 Thanks a lot, it passed :D
•  » » 3 years ago, # ^ |   0 Ur first while loop is doing n interations and for loop is doing |s| iterations ,i.e. , 10^6*10^5 operations!
•  » » » 3 years ago, # ^ |   0 the for loop isn't doing 10^5 operation read it well :)
•  » » » » 3 years ago, # ^ |   0 Sorry my bad..
 » 3 years ago, # |   0 Can someone tell if the round was actually rated?
 » 3 years ago, # |   0 Thank you for the contest, the problems were great. However, there is one tiny issue. 28439979Look at this submit. It passes flawlessly pretests and then gets TLE 16. We can easily notice what happened — author is outputting answer via unsynchronised cout. The real question is — wasnt there any maxtest in pretests in such a valuable problem? KAN
•  » » 3 years ago, # ^ |   +23 In test 3 the output is 50000 lines. Should be enough to test I/O.In test 16 the output is 1 line. The problem is at some other place.
•  » » » 3 years ago, # ^ |   +7 I'm sorry then. Strange, though. The submit looks correct
•  » » » » 3 years ago, # ^ |   +14 Don't use ordered set
•  » » » » » 3 years ago, # ^ |   +12 LOL! Gray retards put minuses again, they don't know that Fenwick tree should be used in such kind of problems as it is much faster.
•  » » » » » » 3 years ago, # ^ |   +1 "Gray retards" ! Be polite man!
•  » » » » » » » 3 years ago, # ^ |   0 Look, it worked! What's happening with this site?
•  » » » 3 years ago, # ^ |   0 And what about div2 C ?TLE AC just for I/O
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 The writer of this comment asks, who is the author?
 » 3 years ago, # | ← Rev. 3 →   +18 A solution with policy-based DS fits exactly in the time limit in Div 1 C:http://codeforces.com/contest/827/submission/28452503It is such a sad fact that i didn't notice that i got WA during contest because i forgot to check the set size.
 » 3 years ago, # | ← Rev. 2 →   +76 Time Limit 2 secs
•  » » 3 years ago, # ^ |   +3 it's Python, baby
 » 3 years ago, # |   0 Problem C in div2 says "**It is guaranteed that the sum of lengths of strings ti doesn't exceed 10^6**".I got RE in this submission: 28448052 Here array size was 1001000.I got AC after increasing array size 2*10^6 in this submission: 28452964Why?
•  » » 3 years ago, # ^ |   -40
•  » » » 3 years ago, # ^ |   +4 Array sze for soln will be a max of 2*10^6.. Consider the case where there is only 1 string of size 10^6 and x is 10^6
•  » » » » 3 years ago, # ^ |   0 Oh, that's frustrating :/
 » 3 years ago, # | ← Rev. 2 →   +1 can anyone tell me why i am getting TLE i dont think so that my code is taking more than 2 secs CODE->28448213
•  » » 3 years ago, # ^ | ← Rev. 3 →   -10 Found the problem!
•  » » » 3 years ago, # ^ |   -18 So what do we do now?? KAN please help us!!!!
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   0 You are copying the string every time.. I changed your code Now it gives WA on 16, so there must be some other mistake 28454163
•  » » » » » 3 years ago, # ^ |   0 actually i got it earlier now i m just trying again and by the way thanks
 » 3 years ago, # |   0 Can someone explain their solution for Div 2C String Reconstruction ?
•  » » 3 years ago, # ^ | ← Rev. 2 →   +1 Keep an array of indices, (we have an array a of length 2,000,000, if a[i] is marked with an index j, this means that there is an occurrence of string j at position i, if multiple strings occur at the same position, save the index of the longest string which occurs at that position). Then, we loop through all of the positions. For each position, if the position is marked and we are not currently printing a string, then we start printing the string marked by the current position. If a position is marked and we are currently printing a string, then we check to see whether the leftover string we are currently printing is longer than the string marked on the current position. If the string marked on the current position is longer than the leftover string we are currently printing, then we stop printing the leftover string and start printing the string marked on the current position. If a position is not marked and we are not in the middle of printing a string, then we just print 'a', since 'a' is the smallest letter.
•  » » » 3 years ago, # ^ |   0 here's the implementation of the exact logic...28470641
•  » » » 3 years ago, # ^ |   0 Thanks
 » 3 years ago, # |   +162 28448669//lol;
•  » » 3 years ago, # ^ |   +86 Hey, don't steal my upvotes =)
•  » » » 3 years ago, # ^ |   +41 I have to admit it, I'm proud of Miyukine. #annealer
•  » » » 3 years ago, # ^ |   +20 Ehh, I'm not so proud now (but still proud). Test were just very weak... First test that came into my mind: "VKVKVKVKVKVK..." with one random change was enough to make these submissions fail:28448669 — WA28448743 — TLE28447467 — TLE
 » 3 years ago, # |   +23 My Rating=2017 in year 2017 :), so to me seems like a notorious coincidence
 » 3 years ago, # |   0 Why does this TLE for Div2C
•  » » 3 years ago, # ^ |   0 Maybe because using lower_bound gives takes log(n) extra time
•  » » » 3 years ago, # ^ |   0 But lower_bound would be called 10^6 times at max so that shouldn't be the case
•  » » 3 years ago, # ^ |   0
•  » » » 3 years ago, # ^ |   0 Yes.But again each element would be erased at most once(no insertions).Why is it timing out?
 » 3 years ago, # |   +16 What is the prize selection algorithm?
•  » » 3 years ago, # ^ |   0
 » 3 years ago, # |   0 For Div2 C, can anyone tell me, why I am getting WA on test for my code: 28454008
•  » » 3 years ago, # ^ |   0 Change max to 2*10*6..
 » 3 years ago, # |   +18 A bit of bit magic helps you to solve E div 2/ C div 1 in O((n / 32)2) time.Code: 28454011
 » 3 years ago, # |   +56 Ugh, n = 1 on F... 28450889 vs 28454566. This is the worst way to get a problem wrong. I want a refund for my brain :-P
 » 3 years ago, # |   0 can somebody plz point out the mistake, I tried for hours now, here's the code 28455191
 » 3 years ago, # |   0 Ah! String Shallow copy denied me a double digit rank.string a = "This is a blunder. I knew it. But I forgot. Dont mess it up"string b = a. //This takes not O(1) but O(n) time :(
 » 3 years ago, # |   0 when will next round?
 » 3 years ago, # |   +1 Challenge in div2 CAdd this constraint "the string can only be reconstructed using the input strings"this is how i understood the problem during the contest and i thought that it was very hard problem
•  » » 3 years ago, # ^ |   +4 me too man
 » 3 years ago, # |   0 I can't access neither my submissions page nor any other user submissions page since the round ended. Server returns page with "The page is temporarily blocked by administrator." message. Does anyone else experience this issue?
•  » » 3 years ago, # ^ |   +1
 » 3 years ago, # |   0 Can someone help me with the Div 2 part C 828C - String Reconstruction. I wrote a solution but get black spaces in between the final string for the answer. Can someone tell me what the mistake might be?Here is my source code:int main(){ //ifstream cin("testcase.txt"); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); char s[1000000]; long long int n; cin>>n; long long int m=0; while(n--){ string str; cin>>str; long long int x=str.size(); long long int t; cin>>t; while(t--){ long long int a; cin>>a; if((a+x)>m) m=a+x; a--; for(long long int i=a,j=0;j
•  » » 3 years ago, # ^ |   0 The given strings, don't fill the whole string. You have to put 'a' s on every position, which wasn't occupied by a character from the input.
•  » » » 3 years ago, # ^ |   0 I tried that too.I initialized the answer character array 's' with all a's. Still I do get blank spaces.
 » 3 years ago, # |   0 Can Someone explain there solution of Div2C Please.Thank You!
•  » » 3 years ago, # ^ |   0 Disjoint Set use this data structure and its O(αn) can solve this problem
 » 3 years ago, # |   -16 is this contest rated btw?
 » 3 years ago, # |   0 Can anyone tell me why my submission is getting a WA on div1A/div2C ?My Submission
•  » » 3 years ago, # ^ | ← Rev. 2 →   0 2aca 2 1 5aba 1 3Answer: acabacaYour answer: acaaaca
•  » » » 3 years ago, # ^ |   0 Thanks for the help, was able to rectify that. Getting a TLE on TC 8 now. Will have to make the solution more efficient, I think. :)
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   0 Yes. You have O(ANS·k) algorithm (where k is sum of ki), but exists O(ANS + k) algorithm that much shorter and easier
•  » » » 3 years ago, # ^ |   0 smirnov.i can you help me :/ ?I got WA on test case 5 while my algorithm works in linear time O(|Size of needed string|) that's good enoughHere
•  » » » » 3 years ago, # ^ |   0 Did you check for the test case provided above in the same comment thread?
•  » » » » » 3 years ago, # ^ |   0 yes :/
•  » » » » 3 years ago, # ^ | ← Rev. 2 →   0 3aaa 1 1abbb 1 3bb 1 4Answer: aaabbbYour answer: aaabbaAfter if in 42 line you have to write i = ii;But your solution seems to bee not linear too, because in lines 37 and 43 you copy the string, so I can give you a test when you will have to copy O(n2) symbols :-) BTW, your solution is very close to AC, you just have to think how not to copy all the string
•  » » » » » 3 years ago, # ^ | ← Rev. 2 →   0 Ohh I thought that this operation works in O(1) but you made it clear to me :) but there's another mistake somewhere :''( , I got WA on test case 5 too Here
•  » » » » » » 3 years ago, # ^ | ← Rev. 2 →   0 But here you should do lst = ii in if, shouldn't you? I can't check it myself, because I'm not in front of my computer now
•  » » » » » » » 3 years ago, # ^ |   0 I think nope :/ because i compare two strings with each others so i used lst = i (the first position before the beginning of the last string) so i am getting its end with lst + size
•  » » » » » » » » 3 years ago, # ^ | ← Rev. 2 →   0 Yes, but in this if you take a new string to compare with others, but you don't update its start. Just try to add this line (lst = ii) in if and submit
•  » » » » » » » » » 3 years ago, # ^ |   0 I'm sorry tooo :(( , but i went to WA on test case 6 lool here
•  » » » » » » » » » 3 years ago, # ^ |   0 Before while:lst = i — 1
•  » » » » » » » » » 3 years ago, # ^ |   +5 finally AC , Big Thanks smirnov.i , you're great debugger by the way :)
 » 3 years ago, # |   0 WA on test 62 421div2 B what is it ?
•  » » 3 years ago, # ^ |   0 421 div2B has only 46 tests
 » 3 years ago, # |   +29 When will the editorial be published?
 » 3 years ago, # |   +6 Where is the tutorial ?
 » 3 years ago, # |   +42 Will we know (after second round ofc.) which task from finals is which?
•  » » 3 years ago, # ^ |   +8 Sure. I'll update the posts with this information.