### Xellos's blog

By Xellos, history, 4 years ago, ,

Hello everyone!

CF round #333 (both divisions) is going to take place today. The authors of this round are me and Baklazan.

By total coincidence, I'm the author of even-indexed problems and Baklazan the author of odd-indexed problems. Now I'm going to let you wonder if it's 0-based or 1-based :D.

As usual, thanks to GlebsHP for his help (in particular, helping us not overkill the problems), MikeMirzayanov for CF and Polygon, Delinur for problem statement translations and our testers: misof, Mimino, AlexFetisov and winger.

I wish good results and rating changes to those who earn it, as well as a zero-sum rating update to everyone.

Score distribution:

Div. 2: 500-1000-1500-2250-2250

Div. 1: 500-1250-1250-2000-2500

Winrars:

Div. 1

Div. 2

(homogeneous colours :D)

• +770

 » 4 years ago, # |   +71 A contest authored by Xellos! I bet the statements will be really funny!
•  » » 4 years ago, # ^ |   +75 By Xellos and Baklazan. I bet that the problems will be really interesting. Even the announcement is nice and precise.
•  » » 4 years ago, # ^ |   -23 LOOOOOL
•  » » 4 years ago, # ^ |   +14 There are many hacks in this contest. This contest will be very interesting.
•  » » 4 years ago, # ^ | ← Rev. 2 →   +26 nevermind
•  » » » 2 years ago, # ^ |   0 I can't stop listening to this!
 » 4 years ago, # |   -17 "as well as a zero-sum rating update to everyone"?
•  » » 4 years ago, # ^ |   +14 you can take this blog as an example. The amount of positive vote Xellos gets here is proportional to downvotes other get. so, the amount of all downvotes here including yours + the amount of upvote Xellos get is almost zero. Hope this helps.
 » 4 years ago, # |   -31 Contest from reds )))
 » 4 years ago, # |   0 the soonest announcement.
 » 4 years ago, # | ← Rev. 2 →   -35 what do you mean of posting a programmer cat photo?
 » 4 years ago, # |   0 I think you have to swap links of (animated version, original)
•  » » 4 years ago, # ^ |   +17 No, I don't. It's correct the way it is.
 » 4 years ago, # | ← Rev. 14 →   +115 You have also changed the screen of the laptop...:D
•  » » 4 years ago, # ^ |   -8 WTF! one gets +110 for such a shitposting?
 » 4 years ago, # | ← Rev. 6 →   -40 Deleted
•  » » 4 years ago, # ^ |   -15 Hi, I am unable to find the funny part in his introduction. Can you quote that part for me please?
 » 4 years ago, # | ← Rev. 2 →   -32 I like your sense of humour :D :D :D (y) @Xellos
•  » » 4 years ago, # ^ |   -15 I dislike your poor sense of humor :D :D :D (N) @SLOW.CODER
 » 4 years ago, # |   -61 Interesting Announcement……………… :)
•  » » 4 years ago, # ^ |   -50 I don't understand why he getting too much negative voted.
•  » » » 4 years ago, # ^ |   -12 Interesting Comment……………… :)
 » 4 years ago, # | ← Rev. 7 →   -108 Xellos write:"I'm the author of even-indexed problems and Baklazan the author of odd-indexed problems"So,The the index of the problems start with 0 or 1?(In other words,A Div2 indexed by 0 or 1?)
•  » » 4 years ago, # ^ |   +201 Yes.
•  » » » 4 years ago, # ^ |   -109 Yes? :-/ What yes? :-/
•  » » » » 4 years ago, # ^ |   +243 The the index of the problems start with 0 or 1? Yes, with 0 or 1.
•  » » » » » 4 years ago, # ^ | ← Rev. 2 →   -88 No,I say Which problem indexed by 0?(A div2,C div2,... or B div2,D div2). It seems that A div2,C div2,... are indexed by 0.(by reading you last answer.).Is it right?
•  » » » » » » 4 years ago, # ^ |   +99 Why would you even consider the possibility of B div2 and above being indexed by 0? That would mean A div2 indexed by a negative number.
•  » » » » » » » 4 years ago, # ^ |   -64 if we indexed A by 1,B by 2 and ... ,problem B div2 ,D div2 and ... are even-indexed but if we indexed A by 0,B by 1 and ... ,problem A div2 ,C div2 and ... are odd-indexed.Is it out of mind?
•  » » » » » » » » 4 years ago, # ^ |   +100 Is it out of mind? Yes — it's on screen. I can keep this up longer than you :D
•  » » » » » » » » » 4 years ago, # ^ | ← Rev. 2 →   -38 Holy heck, you guys are pricks. The guys was asking a genuine question and all you do is downvote him. I mean, yeah sure it's fun messing around with someone for quite a while, but you know... You could just answer his question in one of the comments.Oh and in case you're in the "hurr durr i is veri smart cant read broken englando"-zone, he asks:"Since you are the author of even problems and baklazan is the author of odd problems, does the indexation of problems begin with 0 or 1? In other words, which problems did you design: A, C, E, Div1 E or B, D, Div1 D?"
•  » » » » » » » » » 4 years ago, # ^ |   +71 Why it's so hard to read the post? I'm the author of even-indexed problems and Baklazan the author of odd-indexed problems. Now I'm going to let you wonder if it's 0-based or 1-based :D.
•  » » » » » » » » » 4 years ago, # ^ |   +39 Oh, what a horrible thing I did! FYI I don't want to reveal it yet, so that people could read the problems in arbitrary/strategic order.
•  » » » » » » » » » 4 years ago, # ^ |   -33 Since the debate reached its maximum indentation level, not sure who you guys talking to :p
•  » » » » » » » » » 4 years ago, # ^ |   +23 In the comment headers, there are ^ and # links. Have you ever wondered what they mean?
•  » » » » » » » » » 4 years ago, # ^ |   -38 No. I have better things to wonder, because.
•  » » 4 years ago, # ^ |   -8 I found you so much interested, so I won't make a joke of you. Xellos problems are: A,C,E div1 E and Baklazan problems are: B,D,div1 Fhow much did you enjoy? whose problem are much fun? Hope you got inner piss to get your answer.
 » 4 years ago, # |   +3 Hi Xellos,You did not mention Maria Belova (Delinur) in your round announcement. I'm guessing she did not do problem statement translations?
•  » » 4 years ago, # ^ |   +9 Not yet, since the problem statements aren't ready yet. Mystery of the Early Announcement...
•  » » » 4 years ago, # ^ |   -18 I volunteer for problem statement translation, whenever they're ready.
•  » » » » 4 years ago, # ^ |   +38 From English to English?
•  » » » » » 4 years ago, # ^ | ← Rev. 2 →   -29 What proof do you have that I am not Russian? Or, say, that I don't understand Russian?
•  » » » » » » 4 years ago, # ^ |   -16 tu russian nahi Xellos ka kutta hay :D
•  » » » » » » » 4 years ago, # ^ |   0 He's abusing Xellos, calling him dog. Google translate.
•  » » » » » » » » 4 years ago, # ^ |   -8 So, Bluespeck is Indian. But, Guys he is such an evil. Google can never translate any of my words: Click for Proof. The real translation is:"tu russian nahi" — means, you are not russian"Xellos ka kutta hay" — means, you are a bitch of XellosI didn't abuse any dog calling Xellos. @Bullspeck, Why did you mislead a whole community against me? Learn to respect your own country. People like you are a shame to its own nation.
•  » » » » » » » » » 4 years ago, # ^ |   0 People here are not idiots. The link you gave doesn't translate shit. I translated words, not the whole rubbish you wrote.
•  » » » » » » » » » 4 years ago, # ^ | ← Rev. 2 →   +3 I didn't abuse any dog calling Xellos.Shame on you.
•  » » » » » » » » » 4 years ago, # ^ |   0 After he mentioned India, I translated using some Indian languages, and this is the result click
•  » » » » » » » » » 4 years ago, # ^ |   0 viesis, calling any human a dog is disrespectful. Did Bluespeck/Xellos say anything disrespectful to you before you posted that? btw, the translation is wrong.
•  » » » » » » » » » 4 years ago, # ^ |   0 @Bullspeck, the link shows, google could not auto-detect the language, not even the single word. You set up the language manually. So, how did you know it was written in Indian language at the first shot?Whatever, I have no interest to talk with you anymore. You're just a culprit who has no feelings for its country.
•  » » » » » » » » » 4 years ago, # ^ |   -9 @ruhan, I think calling that Bluespeck as bulldog would be fine. but if you think it is disrespectful to the dog-species then let's call this user ass whole, would it be ok?
•  » » » » » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 Whatever, I have no interest to talk with you anymore. If that is true, then why did you tag me in your next comment? I got an unnecessary mail in my inbox drawing my attention to your nonsense comments and forcing me to give you one final reply. You illiterate dipshit dont you know how to use Google translate? There are many languages in the options as source language, and you uneducated shit using both source and destination as English facepalmI used almost all the languages in drop down menu to come to the realization that the word means dog. I kept changing language till the word didn't translate to the word itself. Took 5-10 minutes that's all.I didn't know it was Indian language at the time, I just figured out what it meant.I am not Russian, and I was shitposting about translating to Russian, for fun. But I am not Xellos' dog, you little twat-faced bitch. I will not respond to any more of your cum ments so GET THE F*** OUTTA HERE YOU BASTARD.
 » 4 years ago, # | ← Rev. 2 →   +134 I don't know how to post gifs, but you can post this instead...
•  » » 4 years ago, # ^ |   +148 My new favourite song...
•  » » » 4 years ago, # ^ |   +39
 » 4 years ago, # |   0 >contest will take place in a few days>proceeds to schedule the contest in 16 days from the announcementI'm calling shenanigans
•  » » 4 years ago, # ^ |   0 The "16 days" is when I made a template with pretty much nothing. Blog post "publishing" times can be misleading.
 » 4 years ago, # |   0 happy coding everyone!
 » 4 years ago, # |   +13 From now on, all(or most of) the contests are held in 'unusual' time, right? A 300000-millisecond-delay!
 » 4 years ago, # |   +19 What's even-indexed problem if our eyes aren't real?
•  » » 4 years ago, # ^ |   +11 15 people get the joke, and I ain't one of 'em sigh
•  » » » 4 years ago, # ^ |   +1
•  » » » 4 years ago, # ^ |   0
 » 4 years ago, # |   +13 Cat. Keyboard. #include ?
•  » » 4 years ago, # ^ |   +14 More like
 » 4 years ago, # |   -15 So the main character of this round will be Pusheen? :D
•  » » 4 years ago, # ^ |   +2 Here you are
 » 4 years ago, # |   -11 Hey, why do you have to conduct all of your competitions on Tuesdays? I can neither participate in round #333 nor #334, because of a Tuesday schedule conflict. Can't you reschedule #334 on another day?
•  » » 4 years ago, # ^ |   +34 There was a blog post about a week ago saying all competitions have been on Wednesdays and Thursdays (or Fridays?) recently. Actually, the statistics of standard CF rounds for the past 2 months including the upcoming contests is: Monday — 1 Tuesday — 2 Wednesdays — 2 Thursday — 0 Friday — 3 Saturday — 1 Sunday — 3
•  » » » 4 years ago, # ^ |   -23 Well, at the very least it would be nice to not have two competitions on the same day of the week (Tuesday) in two CONSECUTIVE weeks, like the case is now... Is there a way to suggest this to admins?
•  » » » » 4 years ago, # ^ |   +28 Is there a way to suggest this to admins?Yes, you can write to them.
 » 4 years ago, # |   0 Auto comment: topic has been updated by Xellos (previous revision, new revision, compare).
 » 4 years ago, # |   +20 Gif is working :O
 » 4 years ago, # |   -49 Is it rated?
•  » » 4 years ago, # ^ |   -17 why not?
•  » » 4 years ago, # ^ | ← Rev. 4 →   +33 What is story of your handle ( dibil1000)?
 » 4 years ago, # | ← Rev. 2 →   -30 MikeMirzayanov would be wrong to expect 333 coderforces t-shirt ( one extra for me to draw attention about it ) for this 333 round :D As 333 round comes only once in a codeforce life time we can expect 333 codeforces t-shirt :D
•  » » 4 years ago, # ^ |   +8 I thought 333 comes once again after N, as other numbers do :)
 » 4 years ago, # |   +17 In the email CF sent Attention! Unusual start time: the round starts on Tuesday, November, 24, 2015 16:35 (UTC). but this is the usual time :D
 » 4 years ago, # |   0 Auto comment: topic has been updated by Xellos (previous revision, new revision, compare).
 » 4 years ago, # |   +54 Nice Russian translation :D.
•  » » 4 years ago, # ^ |   0 I will translate later.
•  » » 4 years ago, # ^ |   +11 Yea,but i hope statemant will translate another person.
 » 4 years ago, # |   +2 I am afraid of this contest :(((((
•  » » 4 years ago, # ^ |   +79 So am I :D
 » 4 years ago, # |   +4 Автори -> Авторы
 » 4 years ago, # |   -29 Wow. The number of "This comment is hidden because of too negative feedback" comments is way too high for this blog post.
 » 4 years ago, # |   -20 I've been shit-posting a lot for the last couple of months, hardly did any competitions, and hated solving problems altogether. I didn't realize that the reason I started hating it is because I've already solved the easy problems and the difficult ones are left. Today I got a real nice kick to think my actions over, and so, after this one, no more shit-posting, only learning and competing and repeat. _< (So mad at myself)
 » 4 years ago, # |   +3 Auto comment: topic has been updated by Xellos (previous revision, new revision, compare).
•  » » 4 years ago, # ^ | ← Rev. 4 →   -16 base64
•  » » 4 years ago, # ^ | ← Rev. 2 →   -16 heh heh heh !
 » 4 years ago, # |   0 The Contest starts with Score distribution announcement :D
•  » » 4 years ago, # ^ |   +6 lool Decoded it using ubuntu :D will be revealed right before the contest
 » 4 years ago, # |   +2 It's funny that ubuntu base64 couldn't decode ZDJsc2JDQmlaU0J5WlhabFlXeGxaQ0J5YVdkb2RDQmlaV1p2Y21VZ2RHaGxJR052Ym5SbGMzUWdL R0ZqWTI5eVpHbHVaeUIwYnlCMApjbUZrYVhScGIyNHBDZz09Cg==, but Mac base64 could.
•  » » 4 years ago, # ^ |   -10 No I have ubuntu and it works for me
 » 4 years ago, # |   +103 ZDJsc2JDQmlaU0J5WlhabFlXeGxaQ0J5YVdkb2RDQmlaV1p2Y21VZ2RHaGxJR052Ym5SbGMzUWdL R0ZqWTI5eVpHbHVaeUIwYnlCMApjbUZrYVhScGIyNHBDZz09Cg==Base64-decoded it ...d2lsbCBiZSByZXZlYWxlZCByaWdodCBiZWZvcmUgdGhlIGNvbnRlc3QgKGFjY29yZGluZyB0byB0 cmFkaXRpb24pCg==Base64-decoded it again ....will be revealed right before the contest (according to tradition)
•  » » 4 years ago, # ^ |   0 I don't get it. How is 'Will' = d2ls ? Please explain it :)
•  » » » 4 years ago, # ^ |   +10
•  » » » » 4 years ago, # ^ |   0 Thanks
 » 4 years ago, # |   0 LOL! :-P
 » 4 years ago, # |   0 Score distribution: ZDJsc2JDQmlaU0J5WlhabFlXeGxaQ0J5YVdkb2RDQmlaV1p2Y21VZ2RHaGxJR052Ym5SbGMzUWdL R0ZqWTI5eVpHbHVaeUIwYnlCMApjbUZrYVhScGIyNHBDZz09Cg== (heh heh heh)....:P.....statement should be really funny...^_^
 » 4 years ago, # |   -60 downvote me
•  » » 4 years ago, # ^ |   0 As you wish :)
 » 4 years ago, # |   -129 The comment is hidden because of too negative feedback, click here to view it
 » 4 years ago, # |   0 if you are too lazy to double decode, here's the score distribution : Div. 1: 500-1250-1250-2000-2500 Div. 2: 500-1000-1500-2250-2250 glhf!
 » 4 years ago, # |   +1 В определеннии константы Липшица подразумевается целая часть? Округляем вверх или вниз?
•  » » 4 years ago, # ^ |   0 As you asked in the English site, I'll answer in English: it's the ceiling function, rounding up.
•  » » » 4 years ago, # ^ |   0 Sorry, my bad. Thank you.
 » 4 years ago, # |   +5 Codeforces was down for me almost all the contest, I couldn't load the page at all, did this happen to anyone else?
•  » » 4 years ago, # ^ |   +23 Codeforces was up for me almost all the contest, I could load the page without any trouble at all, did this happen to anyone else?
•  » » » 4 years ago, # ^ |   +4 I ask because this is the first time this happens to me, I tried with various internet connections, It took me over an hour to get to the front page.
•  » » 4 years ago, # ^ |   +3
 » 4 years ago, # |   +5 Submitted solution of B in last 3 seconds and pretests passed! Phew, that was close!
•  » » 4 years ago, # ^ |   0 How did you solve it? Could you, please, explain? :)
•  » » » 4 years ago, # ^ |   0 Div 2 B was DP . dp[i][0] = longest sequence such that its last element is a[i] and it is the smallest element in the sequence Similarly, for dp[i][1] (if a[i] is the largest element in the sequence) Transitions are : 1 . a[i+1] — a[i] = 1 : dp[i+1][1] = dp[i][0] + 1 2. a[i] — a[i+1] = 1 : dp[i+1][0] = dp[i][1] + 1 3. a[i] = a[i+1] : dp[i+1][j] = dp[i][j]+1
•  » » » » 4 years ago, # ^ |   0 I also have a solution without dp.We can deal with the initial array a to a new array p so that the continous same element will combine.Then for each p[i] we find left_max and right_max and judge whether they can be combined.But this solution is n^2 , we can use a array v to mark the element we have dealed . Because once it was dealed , we dont have to deal it twice. By this trick,it will be a O(n) solution.And thank you for your solution, you know i am not good at dp:) I will deal it with dp tonight:)
•  » » » 4 years ago, # ^ |   0 It's two pointer approach question. We start from i=0 and left=0 and keep track of minimum and maximum elements while traversing and we stop when abs(a[i]-minimum)>1 or abs(a[i]-maximum)>1. Then if(abs(a[i]-minimum)>1) we put left=minimum index + 1 and if(abs(a[i]-maximum)>1) we put left = maximum index + 1. Then again we start traversing with i and these steps repeat until i!=n.
•  » » 4 years ago, # ^ |   0 It looks like the pretests are very weak. I submitted two solutions to C that had a bug in them and passed the pretests.
•  » » » 4 years ago, # ^ |   0 That is the point of the hacking bro :)
 » 4 years ago, # |   +53 TooSimple solved from E to A, like in a div.2 round :'(
•  » » 4 years ago, # ^ |   +8 Good tactic if you can usually solve E reasonably quickly. Relatively easiest to relatively hardest :D
•  » » 4 years ago, # ^ |   +26 It seems my solution to D will fail system test. I find it's wrong right after the contest.
•  » » » 4 years ago, # ^ |   0 What do you think is wrong there?
•  » » » » 4 years ago, # ^ |   +17 Size of array is too small. I use a stack to store trash nodes. But I forget to add the trash nodes to the stack. So it required space.I think I should test my code instead of playing game. (>_<
•  » » » » » 4 years ago, # ^ |   +64 Game name please
•  » » » » » 4 years ago, # ^ |   0 The worst-case memory should be ints. If you're not allocating memory in very a stupid way, it shouldn't be a problem.
•  » » » » 4 years ago, # ^ |   +27 Oops, my solution passed system test. I don't know what happened. >_<
•  » » » » » 4 years ago, # ^ |   +17 So, this contest was too simple for you? ;p
•  » » 4 years ago, # ^ |   +17 Why are you so young and so red?
•  » » » 4 years ago, # ^ |   +13 Asian. :PPS — No offense intended.
 » 4 years ago, # |   +16 That sudden realization 5 minutes before end of contest, that if first city doesn't have a road to the target city, means it has a railroad to that city. So it's a one-dimensional BFS then...
•  » » 4 years ago, # ^ |   +2 These slow Estonians...
•  » » 4 years ago, # ^ |   +1 Holy crap you just ruined my whole day
•  » » 4 years ago, # ^ |   0 Oh... I didn't realize that! How can I not figure it out??
 » 4 years ago, # | ← Rev. 4 →   +5 Div-2 A: I think many forgot the fact that pow(x,y) != ceil(pow(x,y)) Hacked 6 in my room with 3 5 1 0 0 2 24 1 0 
•  » » 4 years ago, # ^ |   0 How? it should be a simple if(25>24) — I used manual powers tho.
•  » » » 4 years ago, # ^ | ← Rev. 2 →   0 25 > 24, but pow(5,2) will return 24.9x, so if you store it as long long, it will get stored as 24.
•  » » » » 4 years ago, # ^ |   0 on my compiler long long x = pow(5,2) returns x = 25
•  » » » » » 4 years ago, # ^ |   0 You can try this : for(i=2;i<=40;++i){ for(j=0;j<=10;++j){ if( ((long long)ceil(pow(i,j)) - (long long)pow(i,j)) !=0 ){ cout<
•  » » » » » » 4 years ago, # ^ |   0 I am unable to understand why could that happen. I tried this on my system, as well as on ideone — link. Both terminate without any output.Could you provide an insight on why would pow(5,2) be 24.9 and not exactly 25?
•  » » » » » » » 4 years ago, # ^ |   +3 Because pow accepts it as a double and double being a floating point type has precision issues. http://www.cplusplus.com/reference/cmath/pow/Kind of similar why one cannot compare doubles precisely.
•  » » » » » » » » 4 years ago, # ^ |   0 But same thing runs fine on my system as well as on online compilers. Why should that behave differently on codeforces?
•  » » » » » » » 4 years ago, # ^ |   0 I don't know the exact reason. The output depends on the compiler I guess. I use Codeblocks and I got (long long)pow(5,2) = 24
•  » » » » » » » » 4 years ago, # ^ |   0 Codeblocks doesn't use g++. It uses a variation of it.
 » 4 years ago, # |   0 That was really tough I tried to solve problem A by converting all values to base 10 and then comparing them,like this,but I kept getting the sum as 0,don't know why,could anyone help? int power = 0; int sum = 0; int s = n - 1; for(int s; s <= 0 ;s--){ int l = x[s] * pow(bx,power); cout << l; int sum = sum + l; power++; } cout << sum; 
•  » » 4 years ago, # ^ |   0 Why do you set int s = n-1 outside the loop then make a new variable with the same name inside it?
•  » » 4 years ago, # ^ |   0 You're declaring a new variable called sum inside the loop. Change int sum = sum + l; -> sum = sum + l; so that it updates the outer scope's sum.
•  » » » 4 years ago, # ^ | ← Rev. 2 →   0 I updated it to this I still get 0 as sum int power = 0; int sum = 0; for(int s = n - 1; s <= 0 ;s--){ int l = x[s] * pow(bx,power); cout << l; sum = sum + l; cout << sum; power++; } cout << sum; 
•  » » » » 4 years ago, # ^ | ← Rev. 2 →   0 In the for loop 's' is initialised to n-1 but the check is s <= 0. Shouldn't it be s >= 0 ? In the present code, the for loop is not getting executed.
•  » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 …
•  » » » » » » 4 years ago, # ^ |   0 Thanks I am not a retard.
•  » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 …
•  » » 4 years ago, # ^ |   0 Why are you declaring int s inside for loop??Should it not be ~~~~~ for(s; s <= 0 ;s--) ~~~~~
 » 4 years ago, # |   +1 i started contest 40 minutes late but it was fantastic!thanks Xellos ! :D
•  » » 4 years ago, # ^ | ← Rev. 3 →   +99 " thanks Xellos ! :D "Hey! I feel offended...
•  » » » 4 years ago, # ^ |   +37 You should feel not active enough on CF :D
•  » » » 4 years ago, # ^ |   +11 thanks Baklazan ^_^
•  » » » 4 years ago, # ^ |   -11 be happy to get thanks from a higher rated coder than 9092301202
•  » » » » 4 years ago, # ^ |   +5 be happy to get reply from rated coders!
•  » » 4 years ago, # ^ |   +17 thanks also misof, Mimino, AlexFetisov , winger !
 » 4 years ago, # |   0 Div2D can be reduced to finding sum of max (a[i]..a[j]) with l <= i <= j <= r.Again, headshot-ed by D. Even O(N log N*Q) solution get TLE. Is there a way to solve D in O(N*Q)?
•  » » 4 years ago, # ^ |   0
 » 4 years ago, # |   0 Could someone tell me what the hell is wrong with my code??? http://codeforces.com/contest/602/submission/14455186
•  » » 4 years ago, # ^ | ← Rev. 2 →   +8 Phew finally found it. Try this71 1 2 2 3 3 3Your code gives 4 but answer is 5.PS — You need to update the value of maxVal and minVal as you traverse through input that's where the problem lies.
 » 4 years ago, # | ← Rev. 3 →   0 Nice contest. I wish i hadn't wasted much time on B though and moved to C directly :\ I am not even sure for B but C was sure if i could submit in time :\ So yeah i was right, 5 more minute would have made it for me :( http://codeforces.com/problemset/problem/602/C --> http://codeforces.com/contest/602/submission/14457506
 » 4 years ago, # |   +7 I was very close to do an unsuccessful hack because of this pearl:#define int long longI guess it helps some coders to not even think about overflow cases but I can imagine many people have fallen for it and failed their hacks. What do you guys think?
•  » » 4 years ago, # ^ |   +3 Right at the same time I complained about the same subject !And unfortunately this trap screwed me in hacking :[
•  » » 4 years ago, # ^ |   +14 I made the exact same mistake last contest. A smart idea actually since ratings is a zero-sum game.
 » 4 years ago, # |   +36 4 unsuccessful hacking attempts !2 of them defined int as long long on A, what's wrong with you people ?
 » 4 years ago, # |   0 For problem C, suppose that the condition that "all pairs of nodes without a railroad connecting them must have a road connecting them" was removed. How then could we solve this problem?
•  » » 4 years ago, # ^ |   +5 2D BFS (my actual solution without realizing the condition you mentioned, probably failed)In a node of a BFS you save position of the bus and the train. Then when you dequeue it, you add all the nodes where bus can go * where train can go, except if their destionations equal. So, if the state is (2,3) it means bus is at the 2nd node and train is at the 3rd node. Then you look where bus can go: for each destionation you look where train can go (except the same destinations) and add them to the queue if they are not visited.
•  » » » 4 years ago, # ^ | ← Rev. 2 →   +3 We can just do it with bfs. Train or bus will get to the city n in 1 hour for sure, because the edge (1,n) belong to bus or to train. For transport, that can't do it, we can just do bfs.
•  » » » » 4 years ago, # ^ |   0 The user I answered to asked what if the condition that train or bus will have a road to the target city would be removed, meaning what if there would be pairs of cities without any roads inbetween.
 » 4 years ago, # |   +15 A new legendary grandmaster is born...
 » 4 years ago, # | ← Rev. 2 →   0 It took me 15min to pass pretests on Div1 B, and then I spent over an hour trying to get an idea of Div1 C, even though they were valued the same :\ . What did I miss? What's the approach for Div1 C?
•  » » 4 years ago, # ^ | ← Rev. 2 →   +21 There are 2 steps here: Use linearity of expectation --> you only need to care about 1 opponent. Use DP to calculate the probability that the opponent has better score
•  » » » 4 years ago, # ^ |   0 I'm not sure I understand. So what if I find the probability that one opponents has better score? How does it scale to M opponents?
•  » » » » 4 years ago, # ^ | ← Rev. 3 →   +14 E(# participants with better score)= (M-1) * E(1 participant has better score)= (M-1) * (probability that 1 participant has better score).
•  » » » 4 years ago, # ^ |   0 I got to step 2, knew it was DP but couldn't figure out how to do it. Looking through the solutions, I see something with prefix sums and a DP table of dp[processed races][current sum], but still don't know how it works :(
 » 4 years ago, # | ← Rev. 2 →   0 Really sorry for them whom are getting WA on 45 in DIV2 A.....I think many of you don't know pow function doesn't work appropriately in codeforces.
•  » » 4 years ago, # ^ |   0 i'm thinking that too! we all are getting WA for that pow()! :(
•  » » 4 years ago, # ^ |   0 The problem is not in codeforces, but in c++.
•  » » » 4 years ago, # ^ |   0 Can you Explain,pls?I was sometimes ago getting wa while upsolving a problem.In a test case my code was showing different output for my compiler and the judge compiler.Then somebody tell me pow function doesn't work appropriately in codeforces.But I really confused that time,Can u pls tell the real reason
•  » » » » 4 years ago, # ^ |   0 Pow() returns double. FE, int(pow(5, 2)) = 24. Because pow(5,2) = 24,999...
•  » » » » » 4 years ago, # ^ |   0 And what is the right solution for this trouble?
•  » » » » » » 4 years ago, # ^ |   0 Just write your own little pow function with long long or use the Horner Scheme to calculate the numbers.
•  » » » » » » » 4 years ago, # ^ |   0 Or just calculate numbers from right to left.
•  » » » » » » » » 4 years ago, # ^ |   0 I suppose you mean this? https://en.wikipedia.org/wiki/Horner%27s_method
•  » » » » » » » » » 4 years ago, # ^ |   0 No, i know that is horner scheme.
•  » » » » » » » » » 4 years ago, # ^ |   0 Okidoki :-) Now i understand :-)
•  » » » » » 4 years ago, # ^ |   0 But I still don't get it. On my machine, int(pow(5, 2)) gives 25. I use g++ 5.2.0 on x64 linux.
•  » » » » » » 4 years ago, # ^ |   0 Try thisa=pow(5,2);printf("%d\n",a);
•  » » » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 Sorry but still the same result... This is my submission: 14443620 My codes gives me the correct result on my machine.
•  » » » » » » » » 4 years ago, # ^ |   0 Change pow() to powl()Please use your own power function. Codeforces has many post related to this.Problem with pow() function
•  » » » » » 4 years ago, # ^ |   0 will ceil(pow ()) do the job ?
•  » » » » » » 4 years ago, # ^ |   0 powl() will work but it's better to make your own function.
•  » » 4 years ago, # ^ |   0 this sucks so much
 » 4 years ago, # |   +16 What's the solution of Div1 B?
 » 4 years ago, # |   +6 What may be the reason of WA40 in div1A?
•  » » 4 years ago, # ^ |   -52 Maybe you use pow in c++, which is incorrect. Try this test: 10 10 9 9 9 9 9 9 9 9 9 9 9 16 2 5 4 0 11 14 3 15 15 Answer: =.
•  » » 4 years ago, # ^ |   -49 Using an stl function pow.
•  » » » 4 years ago, # ^ |   +80 Division 1, guys.
•  » » 4 years ago, # ^ | ← Rev. 2 →   0 Seems we fail if the parity is wrong and there are no cycles to fix it or something. I don't have the edge n->n so it has to go away and return.e.g.I give 3 for 3 1 1 3 The method has no observation about one takes 1->n immediately, just does a BFS on the state (train at, truck at, who moved last).
•  » » » 4 years ago, # ^ | ← Rev. 2 →   -8 Here was irrelevant message about other problem. Thanks for downvoting instead of simply explaining it.
 » 4 years ago, # |   0 i have solved problem C with O(n^3)! will it get TL?
•  » » 4 years ago, # ^ |   0 I think no, because 400^3 = 64000000.
 » 4 years ago, # |   0 How to solve Div 2 C. Is it some kind of 2D BFS ? Can anyone share the approach ?
•  » » 4 years ago, # ^ |   +5 if there is an edge from 1 -> N then we can do a bfs for road system and report the distance of N from 1 , if there is no edge from 1 -> N , there is a road from 1 -> N so we can use that and find distance from 1 to N in rail network and print the distance of N from 1 using rail.
•  » » » 4 years ago, # ^ |   +3 Thanks! I missed the observation that edge 1->N exists either for rail or for road network.
•  » » 4 years ago, # ^ |   +9 No, it is simple 1D BFS, you just need the observation that the there is a road or railway from city 1 to N that will take one hour that is only available for one vehicle and you just need to compute the shortest path of the vehicle that didn't have this edge.
•  » » » 4 years ago, # ^ |   0 Nice!
•  » » 4 years ago, # ^ |   +1 I realized only afterward that if the traintrack isn't directly connected to the end position, then a road MUST be. So the Min time for either the train or the bus is 1. Then, from there on it's a straight up BFS over all the positions and the min number of steps to get to the end is the answer. I still solved it, just rather stupidly...
 » 4 years ago, # |   +2 How to solve Div2 B? What is the main idea?
•  » » 4 years ago, # ^ |   +10 Idea of simplification was to add 1 to all odd numbers of array, then find longest consequence of same elements. And repeat the same with even numbers.
•  » » » 4 years ago, # ^ |   0 How did you come up with that? Did you solve a similar problem before?
•  » » » » 4 years ago, # ^ |   0 You can try theseHotelsArray SubSliding WindowProblems
•  » » » » » 4 years ago, # ^ |   +5 Thank you so much!This is like a fishing rod instead of a fish. Much more valuable than just knowing the solution :)
•  » » » » » 4 years ago, # ^ |   0 Could you help me out to realize what's wrong with this sliding window approach?http://codeforces.com/contest/602/submission/14458195I'm just increasing the size of my window whenever I can do it and then decreasing when there are more than 2 different numbers inside the window, what means that the difference between max and min should be at least 2.
•  » » » » » » 4 years ago, # ^ |   +1 You might run into something like 1 2 1 3 where you would run into 2 mins before hitting a max.
•  » » » » » » » 4 years ago, # ^ |   0 Thanks! :))
•  » » » » » » 4 years ago, # ^ | ← Rev. 2 →   +1 Try this test case65 4 5 6 4 5ans is 3 but your code is giving 4.
•  » » » » » » » 4 years ago, # ^ |   0 Thanks! :))
•  » » » » » 4 years ago, # ^ |   0 Hi can you help me understand why this doesn't work ?http://codeforces.com/contest/602/submission/14498228My idea is to keep low and high and when the difference of either low-high or high-low becomes >= 2 then I move the low or high value to the right until it becomes a valid value.
•  » » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 Input94 5 4 5 6 6 6 6 6Correct output — 6Your code is giving 8. Why? Because when it first encounters 6 then it increments lind to index 1 but it should have incremented to index 3.
•  » » » » » » » 4 years ago, # ^ |   0 Thanks!
•  » » » 4 years ago, # ^ |   0 Thx) Also I saw another versions of solution, someone uses RMQ, dichotomy... So variative)
•  » » » » 4 years ago, # ^ |   0 What is RMQ and how dichotomy can be used for that problem? :)
•  » » » 4 years ago, # ^ |   0 I tried a similar approach.Finding the longest sequence of two or less numbers:14460365
•  » » 4 years ago, # ^ |   0 Even O(n^2) are passing.Its sad.
 » 4 years ago, # |   0 very good contest!thank you a lot!
 » 4 years ago, # |   0 In this round Tlekbay and Shadow00 are cheaters.Here are their solutions for B:14455707
•  » » 4 years ago, # ^ |   +3 Check their ranks in Round 322 -> 276 and 277
•  » » 4 years ago, # ^ |   0 yeah, their codes are identical. Any idea why their run-times differ? (One is 202ms and the other 187ms)
•  » » » 4 years ago, # ^ |   0 one is in c++ other in c++11
•  » » 4 years ago, # ^ |   0 It's out of competition though right? Is that still considered cheating?
 » 4 years ago, # |   +10 Could you explain what does the name of div1D mean? In Russian it's pretty nonsense not related to the problem (or I'm too dumb to notice it).
•  » » 4 years ago, # ^ |   +10 It has no connection to the problem other than what a tree with any letters is in chemistry. (Organic chemistry really has a letter for everything — R stands for "anything", for example.)
 » 4 years ago, # |   +19 I'm actually stunned of how test cases are so strong for problem C and weak for problem B. If you want to know what I mean look at this submission. http://codeforces.com/contest/602/submission/14448575 and got Accepted! with complexity O(n^2)
•  » » 4 years ago, # ^ |   0 Wow, so there was no need for dp. Now this really looks like a div2B problem.I need to adjust my assumptions about the speed of codeforces machines, so maybe next time I'll do better in the contest :)
•  » » » 4 years ago, # ^ |   0 Why would it need a dp :| You can do it in O(n) without the need of dp anyways.
•  » » » » 4 years ago, # ^ | ← Rev. 2 →   0 I didn't understand that when I wrote that comment.Now I know that there is a very beautiful solution described here :)
 » 4 years ago, # |   +32 I enjoyed all problems so thank you for a round Baklazan and Xellos.Though I don't like your editorial. Hints are better than no editorial at all but I would prefer to be able to decide if I want to read whole solution immediately.
•  » » 4 years ago, # ^ | ← Rev. 2 →   +24 I would prefer to be able to format everything properly immediately. But we don't always get what we want.This is still better than waiting for everything at once.
•  » » 4 years ago, # ^ |   0 Where is the editorial?
•  » » » 4 years ago, # ^ |   -6 keep your eyes open or go to bed. can't you see this cutiye ki editorial
 » 4 years ago, # |   +3 I am getting correct answer on my PC but WA in CF: http://codeforces.com/contest/602/submission/14455593
•  » » 4 years ago, # ^ |   0 During Educational Codeforces Round 1 hacking, I found distinct answer for a same code ran in my PC and CF. However, I didn't know why.
•  » » » 4 years ago, # ^ |   0 Maybe the precision of double
•  » » » » 4 years ago, # ^ |   0 But I have not used floats or doubles anywhere in my code.
•  » » » » » 4 years ago, # ^ |   0 the function queryInternal doesn't return anything. Whether it goes wrong?
•  » » » » » » 4 years ago, # ^ |   0 Thank you for helping. I corrected it and it got accepted. non-void function not returning a value is undefined behavior.
 » 4 years ago, # |   +4 Admins Please take a note on this. Strange thing happened I don't know the reasong. In my solution 14444210 to the Div 2: prob A. It says wrong answer to test case 45. I have tested with the same test case in my system as well as in ideone.com here and gives the correct output. Please look into the matter. Thank You
•  » » 4 years ago, # ^ |   0 You used pow function which gives say pow(5,2) is 24.999999. So when you take the long long you actually get 24...
•  » » » 4 years ago, # ^ |   0 but then why does it work on my pc (using g++ btw in linux system just in case) and also the online compilers. And that makes pow totally worthless!!
•  » » » » 4 years ago, # ^ |   +12 I am not entirely sure, but once I put round() around my pow function, it worked.
•  » » » » » 4 years ago, # ^ |   +5 K... I had to implement my own pow function to get it accepted!! Btw thanks... I am not going to use pow again!! it was strange tho!!
 » 4 years ago, # |   +3 Nice problems and nice day. But I still don't know why I get RE on pretest 8 in Problem B div.2 for my first solution.
 » 4 years ago, # |   +5 What is the reasoning for not including any big tests to break single hashing in pretests?
•  » » 4 years ago, # ^ |   +19 Well. Why would they want such a test in pretests?
•  » » » 4 years ago, # ^ |   +8 I mean, pretests should test basic correctness. If the solution is going to fail on most big tests, it seems to me pretests should check that.Most of the reasoning for weak pretests is for hacking. (right?) D's don't get hacked a lot and it's pretty risky to hack so it doesn't seem to serve this purpose. I guess this is mostly about the point of system testing, which I don't think is to make people fail.Well, anyway I guess I shouldn't assume that such tests are included next time and just double-hash to begin with :/
•  » » » » 4 years ago, # ^ |   0 I think you should estimate the probability of collision first. https://en.wikipedia.org/wiki/Birthday_problem
•  » » » » » 4 years ago, # ^ | ← Rev. 3 →   +5 You are absolutely right about checking probability. I mostly was thinking that pretests would catch bad solutions (as per CF's increasing tendency to have strong pretests, maxtests, etc.) Rather, I'm referring to what seems to me intentionally failing these tests in systests rather than pretests: (Also re: desert97)I was assuming that the authors let hashes pass pretests intentionally and fail later, not just randomly. This is based on statements like "which is why there are anti-hash tests :D" (which might be referring to abbabaab... instead), but also how almost all hashers failed test 13, even with different hash systems. If this is correct, this is the thing that seems kinda bad to me since it's just there to make people fail. I feel like that's what pretests are for and designed to do — make it so people don't think their solution is right when it actually has a big problem. Of course hacks lessen this problem, but who hacks on D? (oops rev1 was correct...)I'm also a little annoyed at dropping from 10th to 105th due to systests :/, but I think I would still think the same way if I passed. Pretests are something that have always been a bit strange, and I guess I would appreciate a bit more clarity and consistency on their purpose.
•  » » » » 4 years ago, # ^ | ← Rev. 2 →   0 I think the above thought process (referring to waterfalls's post) is not correct. Think about it this way:Say there are 10 pretests (standard) and 60 total tests. Say that there is a probability p that you get hash collisions. (One can compute p with some NT maybe...) Let's assume p is fairly small.The probability that you pass all pretests is: (1 - p)10. The probability that you pass all tests given that you pass pretests is (1 - (1 - p)50) ≈ (1 - p)10·(1 - (1 - 50p)) = 50p. So if p is something like 1 / 100,  you'll pass all pretests with something like 90% chance, but pass all final tests given that you passed pretests with only 50% chance. It could just be a probability thing. The 90% is probably even an overestimate given that most pretests are very small cases, so p ≈ 0 in those tests.If I did shitty math, please tell me.
•  » » » 4 years ago, # ^ |   0 In problem B of division 2 O(N^2) is passing system testing
•  » » » » 4 years ago, # ^ | ← Rev. 2 →   0 I had O(N^2) and someone hacked me with time limit exceeded!
 » 4 years ago, # |   +29 Good problemset I'd say.
 » 4 years ago, # |   0 My solution has been skipped ... I do the Contest & solve the Problem for Upgrading my Rating ... then why this types of injustice ... Watch my submissions ... They didn't match to any others but any others submissions match to mine ... But why should I get the Penalty of rating loss?? what type of injustice is that ???
•  » » 4 years ago, # ^ |   0 Newbie solved problem c kinda sketchy no?
•  » » » 4 years ago, # ^ |   0 Hello ... I did ... BFS, DFS , DIJKSTRA, FLOYD-WARSHALL . And this problem was from BFS , DIJKSTRA AS I guess .Its not NEWBIE can't do the HARD Problems ?? Then what do you say when an Unrated got First ???" Newbie solved problem c kinda sketchy no?" What a Thought !!! Trully ...
•  » » 4 years ago, # ^ |   0 Top 4 lines of your solutions A and C say it all :P
•  » » » 4 years ago, # ^ |   0 What does the Top 4 Lines of My Solutions Saud ???
 » 4 years ago, # |   +24 OMG, waiting for rate changing will kill me one time.
 » 4 years ago, # |   0 Auto comment: topic has been updated by Xellos (previous revision, new revision, compare).
 » 4 years ago, # | ← Rev. 2 →   0 for problem(A): My code passed all pretests but was rejected in systesting on testcase#45. When I run this testcase in my pc its giving correct answer, u can see my code in my submissions.Test: #45, time: 0 ms., memory: 0 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER Input 9 39 10 20 16 36 30 29 28 9 8 9 38 12 36 10 22 6 3 19 12 34 Output < Answer = Checker Log wrong answer 1st words differ — expected: '=', found: '<'
• »
»
4 years ago, # ^ |
Rev. 2   0

# c0der_ :: i am also facing the same problem

even my code for problem(A) was hacked on a test case and now same code is being accepted when i submitted after the contest without any editing

•  » » 4 years ago, # ^ |   0 do you compile it with -O2 ???
•  » » » 4 years ago, # ^ |   0 no
•  » » 4 years ago, # ^ |   0 dont use power function. your code power function does not work correctly.so, if a=2,and b=3; find a^b; for(int i=1;i
•  » » » 4 years ago, # ^ |   0 but it is passing the test case on which it was hacked
•  » » » 4 years ago, # ^ |   0 where does it not wok properly? why its working on my pc and not on codeforces ? plz explain.
 » 4 years ago, # |   0 Now it is midnight,but still wait for rating. After brainstorming ,pain in the brain. So,plz give the rating as soon as possible.
•  » » 4 years ago, # ^ |   0 "Give" me a rating too @Admins :D
 » 4 years ago, # |   0 It seems that many O(N^2) algorithm are passing system tests for test B. I think the solutions for atleast B should be rejudged.
•  » » 4 years ago, # ^ |   0 yeah, now today was surely a bad day I solved 2 problems within 50 mins and both of them was rejected during system testing and I dont't know why . for problem A if the power function doesn't work , then it should give wrong in my pc too but when i checked ,the answer is correct in my pc.for problem B its giving TLE after system testing. Is anybody having the same problem ? can anyone explain me why this mismatch is happening?
•  » » » 4 years ago, # ^ |   0 c0der_ :: i am also suffering from same problem
•  » » » 4 years ago, # ^ |   0 Man i am saying that O(n^2) solutions are not bound to pass because n=100000 but i saw various problems in which it is passing in 1900ms
•  » » » » 4 years ago, # ^ | ← Rev. 2 →   0 Ok they have carefully applied n^2 breaking the inner for loop when required but the setter needs to create such cases where these solutions do not pass.
•  » » » » » 4 years ago, # ^ |   +1 It is no first!
•  » » » 4 years ago, # ^ | ← Rev. 2 →   0 c0der_ do you have wrong answer on test 45 on problem A?
•  » » » » 4 years ago, # ^ |   0 yes ivokaragyozov in system testing it gives wrong but is fine when i run it on my pc.I read the above comments but still the concept behind this is not clear to me .There must be some valid logic behind this.
•  » » » » » 4 years ago, # ^ |   0 Do you use pow function?
•  » » » » » » 4 years ago, # ^ |   +3 yes,and now its accepted . I used ceil(pow()) instead of just pow(). But one thing is still bothering me , if pow(a,b) gives wrong result on codeforces for some a,b then why its correct on my system?
•  » » » » » » » 4 years ago, # ^ |   0 The way that mathematical operations are done on each computer can be different as different processors can use slightly different algorithms for certain mathematical operations. If you went out and bought the exact computer they are working on and compiled with the same compiler, you would get the same result as on CF.
 » 4 years ago, # |   +4 When will rating changes be updated?
•  » » 4 years ago, # ^ |