### Tommyr7's blog

By Tommyr7, history, 9 months ago, ,

Hi, Codeforces! Happy Valentine's Day. And happy Lunar New Year!

I'm quite honored to invite you to Codeforces Round #462 which will take place at 15:05 MSK on 14 Feb and last for two hours.

The authors are quailty, skywalkert, visitWorld and me. This is our second round here.

The round couldn't have been realized without efforts of KAN and our testers: cyand1317, demon1999. Thanks for your help to the contest. Also, thank MikeMirzayanov for the fantastic Codeforces and Polygon platforms.

The contest will consist of five problems and it is rated for both division contestants.

The background of problems will be about Lunar New Year. (Yes... Not Valentine's Day...)

Hope to see you in the contest! Good luck and have fun, wish you a high rating!

We suggest that those who already have Valentine's Day plans should not participate... You can always upsolve a contest, but there is only one Valentine's Day ;)

The scoring distribution will be announced later.

See you in the contest!

UPD: The scoring distribution is:

div1: 500 — 750 — 1500 — 2250 — 2500

div2: 500 — 1000 — 1500 — 2000 — 2500

UPD2: Congratulations to the winners!

### Division 1 :

1. Um_nik (solved all problems!)
2. Golovanov399
3. geniucos
4. fateice
5. kriii

### Division 2 :

UPD3: The editorial is available now!

Thank you everyone!

Happy Valentine's Day and happy Lunar New Year!

See you next time!

•
• +544
•

 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   +86 Another Goodbye 2017
 » 9 months ago, # |   0 Thought of not participating at contests for a while but when i saw the nationality of the writers....
 » 9 months ago, # |   +93 An interesting fact:Feb/14/2018 is the 72th anniversary of the first computer ENIAC.(So I'm going to spend the Valentine's Day with computers, codes and algorithms QAQ)
 » 9 months ago, # | ← Rev. 2 →   -6 16 contests announced. I've never seen more on the future list, keep it like this codef
 » 9 months ago, # |   +164 Good thing there is a contest on Valentine's day! Now I will be solving problems instead of watching porn :)
 » 9 months ago, # |   +519 :D
•  » » 9 months ago, # ^ |   +269 After valentine's day, probably:
•  » » 9 months ago, # ^ |   -19 this meme is old, don't use it please
•  » » » 9 months ago, # ^ |   +35 good meme never dies
•  » » » 9 months ago, # ^ |   0
•  » » 9 months ago, # ^ |   +261 Girlfriend? Not exists. ┑(￣Д ￣)┍
 » 9 months ago, # |   +175 I thought for a second to skip the contest and go out with my GF, but I realized that I don't have one (sad emojis ...)
•  » » 9 months ago, # ^ |   +65 But have two? :D
•  » » 9 months ago, # ^ |   0 But you have a boy friend dont you~~
 » 9 months ago, # |   +1 I don't think your second warning is necessary -- we are on Codeforces, after all :-)
 » 9 months ago, # |   +24 Hope there will not be combinatorics C like in last Tommyr7's last round
•  » » 9 months ago, # ^ | ← Rev. 3 →   -7 AFAIK It's DP.UPD. It's combinatorics, you are right
•  » » 9 months ago, # ^ |   +21 Do you think that div2C is too easy or too difficult?
•  » » » 9 months ago, # ^ |   +4 it was like usual div2c
 » 9 months ago, # |   +6 Finally! Something good on 14 feb. ;)
 » 9 months ago, # |   +240 I hope this round will not like that.
•  » » 9 months ago, # ^ |   +16 Oh like the past rounds when you could get more with A B and hacks than with A-E ?
•  » » 9 months ago, # ^ |   +4 Overused meme done right :v
•  » » 9 months ago, # ^ | ← Rev. 3 →   0 Unhopefully for you it was exactly like that.
 » 9 months ago, # | ← Rev. 2 →   +46 Ahh,codeforces doing unpaid job for Bajrang dal :| (only indian can understand it)
•  » » 9 months ago, # ^ |   0 :DSponsored by
 » 9 months ago, # |   0 I remember what happened in your last contest mate ;) I hope the mistakes are not repeated this time :P :P
 » 9 months ago, # | ← Rev. 3 →   -33 Can you call it "Lunar New Year" instead of "Chinese New Year"? This festival is also meaningful for all East Asia countries (Vietnam, Nouth/South Korea, Japan, Taiwan, Hong Kong, ...), not just China. The background of the festival is based on the orbit of the moon (instead of the sun in the normal Julian calendar), then we call it "Lunar New Year". So if you change the phrase, you can support more programmers in Codeforces where there are so many programmers come from the East Asia countries. Thank you.
•  » » 9 months ago, # ^ |   +3 But the blog poster knows the holiday as "Chinese New Year", and most people know what it is, so I don't see the point. You can call it "Lunar New Year" yourself if you want to.
•  » » 9 months ago, # ^ |   +29 I'm really sorry about it and I have fixed it now. Thank you for pointing out!
•  » » 9 months ago, # ^ | ← Rev. 2 →   +91 Not safe for political tryhards, especially during New YearPlease no more political tryhards complaining some places being listed as a country, thank you.
•  » » 9 months ago, # ^ |   +34 Taiwan and Hong Kong are not countries. Please correct it immediately.
•  » » 9 months ago, # ^ |   0 But it originates in china, at all. There is not any problems to call it Chinese New Year. You can see it clearly in the problem background.
 » 9 months ago, # | ← Rev. 4 →   -8 '
•  » » 9 months ago, # ^ |   0 hey
 » 9 months ago, # |   0 Codeforc always gives new things in a new event. I want a girls friend from this contest for current event in this world :D :D :D :D
 » 9 months ago, # |   +2 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   +4 Again Tommyr7's Round. I like it!
 » 9 months ago, # | ← Rev. 3 →   +1 That moment when the round organizer cares more about your romance life than competitive programming!!This level is off the charts! LOL xD
 » 9 months ago, # | ← Rev. 3 →   +22 I think up votes for this post raised so high cos the writer mentioned the line "We suggest that those who already have Valentine's Day plans should not participate... You can always upsolve a contest, but there is only one Valentine's Day ;)" :P ;LOL
 » 9 months ago, # |   0 Happy Lunar New Year and hope a good contest!However,dear MikeMirzayanov, why I cannot open the problemset and history contests?
•  » » 9 months ago, # ^ |   +1 Fixed, check.
•  » » » 9 months ago, # ^ |   0 Thanks
 » 9 months ago, # | ← Rev. 2 →   +4 Obligatory comment: "Hope the problem statements are as short as the announcement"0v0
•  » » 9 months ago, # ^ |   -18 That was my joke. Please don't steal it
•  » » 9 months ago, # ^ |   +2 LSY! Found ya! %%%
 » 9 months ago, # | ← Rev. 3 →   +14 lunar new year or.. Chinese new year....We need to stay with parents and extend family..The contest is very suitable for me to avoid doing some new year's work that day:)
•  » » 9 months ago, # ^ |   +5 Ended, Happy New Year!!!
•  » » 9 months ago, # ^ |   +1 baobao wwww
•  » » » 9 months ago, # ^ |   0 hhhhhh, happy new year
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 Happy new year~ 阖家欢乐~
 » 9 months ago, # |   +6 lol coders having valentines :/
 » 9 months ago, # |   +16 Codeforces is my actual girlfriend
•  » » 9 months ago, # ^ | ← Rev. 4 →   0 Someone humanise Codeforces-chanThe image is too big
 » 9 months ago, # |   +93 This contest is my boyfriend so I hope it has a hard D problem
 » 9 months ago, # |   0 For chinese prople, maybe a New Year wish is better than a hign rating happy_New_Year Happy_New_2018
 » 9 months ago, # |   +83
 » 9 months ago, # |   +2 Wow, that's fantastic, especially for the time of the contest.Ahh, although for the Valentine's Day.Gook luck, everyone. And best wishes for everyone in the New Year!
 » 9 months ago, # |   0 The contest coincides with Slovakia — Russia hockey match...
 » 9 months ago, # |   0 Fifteen words,fifteen words,fifteen words,fifteen words,fifteen words
 » 9 months ago, # |   +25 You can easily find a girlfriend, but you can hardly find a cf contest early like this(a contest ends before my bed time).
 » 9 months ago, # |   +31 A great contest for single dog(Just a joke) :P
 » 9 months ago, # | ← Rev. 2 →   +13 Tommyr7 registered this contest... rank++...
•  » » 9 months ago, # ^ |   +13 Just a joke, don't be serious~~~
 » 9 months ago, # |   +7 maybe you can enjoy this round with your girlfriend:D
 » 9 months ago, # | ← Rev. 3 →   -8 It is clashing with my dinner could you please shift-up contest more later ?) UPD: Ok, I will eat KFC before contest, no problem )
 » 9 months ago, # |   0 14, 15 and 16th Feb 3 contests back to back.
 » 9 months ago, # |   +14 Give me a good reason why I'm still at home on Valentine's day, because I want to attend Codeforces Round #462
 » 9 months ago, # |   +18 Looking forward to screencasts of people participating in this contest. Preferably with their dates and a glass of wine.
•  » » 9 months ago, # ^ |   +87 I have my dates already prepared...
•  » » » 9 months ago, # ^ |   +10 ooom ^-^ — — — — — — — - — -
 » 9 months ago, # |   +29 Tommyr7, how to solve div2E?
•  » » 9 months ago, # ^ |   +72 brute force
•  » » » 9 months ago, # ^ |   0 Actually, there is a polynomial solution. Note that instead of generating the permutations we can just calculate the determinant of the matrix
 » 9 months ago, # |   0 Came here to make a comment on how I don't have a girlfriend and codeforces contest is one true love.
 » 9 months ago, # |   -6 Maha Shivratri >= codeforces round > valentine's day :D
 » 9 months ago, # | ← Rev. 2 →   +31 Next time, codeforces should do back to back 7 contests, starting from 8 to 14 Feb. So, we can stay motivated. :)
 » 9 months ago, # | ← Rev. 5 →   -56
 » 9 months ago, # |   -8 Imagine , your crush made an anonymous CF handle only for you and knocked you in CF to surprise you on valentine day . But you are finding yourself so much closer to solve the problem on your hand that you u can't reply despite seeing it . How will be that moment . :(
 » 9 months ago, # |   0 So, finally something for us(single people) :D
 » 9 months ago, # |   +6 Happy Valentine's day, good coding for everyone at the contest Codeforces Round #462 :)
 » 9 months ago, # |   +8 Two consecutive valentine day and also codeforces round on both days! :O (2017, 2018)
 » 9 months ago, # |   +27 I'm grateful to CodeForces and the contest writers for giving me an opportunity to spend such an unforgettable Valentine's day with my beloved codes and algorithms.
 » 9 months ago, # |   +88 Click friend standings and you will find who have no girl friend.
 » 9 months ago, # |   +3 Woah, 5 contests in a single week! Awesome!!!
 » 9 months ago, # |   +18 Valentines Present by Codeforces.
 » 9 months ago, # |   0 Four authors and all of them have different colours, interesting coincidence))
 » 9 months ago, # | ← Rev. 4 →   -34 ...
 » 9 months ago, # |   +16 btw, Valentine's day is every year :D
 » 9 months ago, # |   +14 Pyaar ek dhokha hai, rating badha lo yehi mauka hai :P
•  » » 9 months ago, # ^ |   0 sakht comment
 » 9 months ago, # |   +3 Tommy?Tommy!
 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   0 Are the problems shared between both the rounds? If yes, then Div 2 D would be easy than usual if its worth 750 for Div1 participants. Maybe XD
»
9 months ago, # |
+3
##### TO EVERY PEOPLE IN CODEFORCES:

HAPPY VALENTINE'S DAY

HAPPY CHINESE NEW YEAR!

•  » » 9 months ago, # ^ |   +13 yay! this is my year according to the chinese calendar, and if I'm not mistaken it is also tourist year since we are both born in 1994
»
9 months ago, # |
+2

#### WISH YOU ALL HAVE A GOOD TIME IN THE RATED CONTEST!

 » 9 months ago, # |   +2 hack is stuck. Infinitely loading.. Is this happen occurs only for me?
•  » » 9 months ago, # ^ |   0 close, tab and reopen. bug in codeforces platform
•  » » » 9 months ago, # ^ |   +6 only if I knew this situation 1.5hr earlier, I can hack a lot because I started to hack 10 minutes after the contest begin :( Anyway, thanks a lot!
 » 9 months ago, # |   -15 In DIV2 B for the first test case can 04 be a valid answer?
•  » » 9 months ago, # ^ |   0 No, i asked that during the contest
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 Got it! Thanks for all the positively negative responses.
 » 9 months ago, # |   +6 rating predictor is not working
 » 9 months ago, # |   -11 The rating changes from the CF-Predictor Plugin are all 0's. Is this contest rated?
 » 9 months ago, # | ← Rev. 2 →   +7 Why Div2A is harder than Div2B?
•  » » 9 months ago, # ^ | ← Rev. 3 →   -6 :(
 » 9 months ago, # |   +26 First problem was prettier than my girlfriend
 » 9 months ago, # |   +3 Negative CF rating. its Valentine's Day cure for not having girlfriend
 » 9 months ago, # |   +5 Div1B got me so much time to understand that answer for case p < k is just p, and I have to hardcode it. Damn it.
•  » » 9 months ago, # ^ |   0 Well, I just transform p into its negative base
•  » » » 9 months ago, # ^ | ← Rev. 2 →   +3 I did the same thing, ofcourse, but didn't figure out that it's actually a negative base.
•  » » 9 months ago, # ^ |   +5 well, at least you did that, i couldn't figure that out. :(
 » 9 months ago, # |   +26 B seems to be standard: "Represent a number in negative base".
•  » » 9 months ago, # ^ |   0 Why does such problem exist? It easy to search on gg: https://www.geeksforgeeks.org/convert-number-negative-base-representation/
•  » » » 9 months ago, # ^ | ← Rev. 2 →   +19 The main part of the problem is not doing the base representation itself, but figuring out how base representation helps for this problem. For people like me who are not that smart, it takes time for us to figure out that the solution for B is just to represent p in base (-k). Although it may seem trivial for you, I think that the problem is interesting.
•  » » 9 months ago, # ^ |   +8 for example, for me its not obvious
•  » » 9 months ago, # ^ |   0 I agree, but it seems a bit harder to figure out if you don't know that and try to expand the formula given in the statement instead.
 » 9 months ago, # | ← Rev. 2 →   +20 What's tc 8 in div1 C?Well, what I did was, taking points from (-21, -21) to (21, 21). Since you can't take all of them, I magnified the grid by 100*100, and took all lattice points there. And for each point, find in what circles it lies in.
•  » » 9 months ago, # ^ |   +29 I didn't take into account this case:3-1 0 11 0 10 0 2the answer seems to be 5.
•  » » 9 months ago, # ^ |   +13 my error was that it if there is no commmon area among the 3 circles than also it is possible that plane is divided in 8 regions
•  » » » 9 months ago, # ^ |   +3 Oh thanks, made the same mistake :/
•  » » 9 months ago, # ^ |   +7 I think it looks like
 » 9 months ago, # |   +12 Happy Hackentine day!
 » 9 months ago, # |   0 Summary in Div2: Codeforces Round #462 (Div.2) a.k.a. Skip C-D and solve E...(I know, counting all possible cases for E was still a pain, but to me and many others it is still easier than solving C/D).Anyway, anyone knows about pretest 3 of C? ._.
•  » » 9 months ago, # ^ |   +3 The subsequence does not have to be contiguous.
•  » » » 9 months ago, # ^ |   0 What? So that meant I've got it wrong all along...Feeling like a dumb right now...Thanks for the support anyway...
•  » » » 9 months ago, # ^ |   0 A non-decreasing subsequence is a sequence of indices p1, p2, ..., pk, such that p1 < p2 < ... < pk and ap1 ≤ ap2 ≤ ... ≤ apk. The length of the subsequence is k.Doesn't this imply sequence has to be contiguous?
•  » » » » 9 months ago, # ^ |   0 No. It's only contigous when p(i) = p(i-1) + 1 (with 1 < i <= k).
•  » » » » » 9 months ago, # ^ |   +1 Okay makes sense. Was solving in the contest thinking it had to be contiguous :( Thanks anyway
 » 9 months ago, # |   +4 Guys, remember that -x * -x = +x²Case for problema A:3 3-7 1 5-7 1 5
 » 9 months ago, # |   +10 The thing in A is not to use your mind -_- just simulate the process with O(N^3)
 » 9 months ago, # |   -56 after months of participating in codeforces contests i ve come to the conclusion that the problems are generally trash with weak pretests and badly translated statements , written by sad weeaboos calling themselves programmers and problem setters so i will leave forever this site here is my passowrd : codeforcesistrash . bye
•  » » 9 months ago, # ^ |   -25 I made sure you will not participate again, at least with this account :)
•  » » » 9 months ago, # ^ |   -19 by the way can you change the email thx bye again
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 btw u werent supposed to change the password so that anyone can come visit my account i will send ticket to email noob
•  » » » » » 9 months ago, # ^ |   +34 You are like a girlfriend that you are breaking up with, and she like "I'm leaving and never will write you again" and then writes you like 9000 messages about how she hates you and how she won't ever write you again. Just leave, omg, nobody gives a shit.
•  » » » » » » 9 months ago, # ^ |   -15 you are autistic lol
•  » » » » » » 9 months ago, # ^ |   0 you are just mad i was the first to steal his account lol
•  » » » » » 9 months ago, # ^ |   0 I did not know we can change email-id on CF.. Try now?
•  » » » » » » 9 months ago, # ^ |   0 gut danke
 » 9 months ago, # |   +46 I expect a lot of hacks at div1C, I wouldn't like to see more such tasks in future : Some participants had finished codes there is a lot of cases + geometry — more 5h ACM style Other tasks were great to me.
 » 9 months ago, # |   0 in problem D Div 2 are polynomial always exist
•  » » 9 months ago, # ^ |   +13 Yes, substitute x=-k into the polynomial and you will find that f(x)=q(x)*(-k+k)+p=p. Thus, the coefficients of f(x) are just the base (-k) representation of p, and the coefficients will always be smaller than k since it's base k.
 » 9 months ago, # | ← Rev. 2 →   +59 Task C div1 / E div2 looks as easy version of one task from Timus.
 » 9 months ago, # |   +38 i hated this contest : - unclear statements - a lot of math tasks - a lot of hacks ( which i don't like personally ) - uninteresting tasksThank you for trying and please don't do it again
•  » » 9 months ago, # ^ |   +2 Agree with bad English statements
 » 9 months ago, # |   0 Is this true?For Div2D, notice that although decimal coefficients are allowed for q(x), in no solution will q(x) have a decimal coefficient (??)Proof: Suppose some coefficient a_k is a decimal number. Then x*a_k will leave a decimal residue, to remove which you will need another decimal coeffcient for q(x). This cycle will never end.
•  » » 9 months ago, # ^ | ← Rev. 2 →   +6 in g(x) all coefficients are integer. f(x) = (x + k)(g0x0 + ... + gmxm) + pSo f0 = kg0 + p;f1 = kg1 + g0;...fm + 1 = gmSince fm + 1 must be integer, gm is integer to. And all gi integer.
 » 9 months ago, # |   0 I am surprised to see a lot of C++ submission for B. It seemed that people would rather implementing big number than writing this problem in a different language.For C, what is the easiest (fastest to implement) method to find intersection of two circles? My idea is to divided the grid into k2 point, and for each point find the set of circles that this point is in (represented by a bitmask), and then the answer is the number of distinct bitmask. It seemed that setting k = 2000 is not enough (higher k will not run in time). So I thought about considering each circle center and points near the intersection of any two circles, and got stuck and the intersection thing.
•  » » 9 months ago, # ^ |   0
•  » » 9 months ago, # ^ |   0 i tried this too but had a case i forgot to handle. There maybe more than one (at most 2) region with the mask 0 (point out of every circle). One region is when all three circle touch each other
•  » » 9 months ago, # ^ |   +11 bitmask is wrong. Two point have the same bitmask can be in different region.
•  » » » 9 months ago, # ^ |   0 I had a specific case that bitmask is wrong, but only with the "outside of all 3 circle" bitmask. I couldn't find any other case.
•  » » » » 9 months ago, # ^ |   +1 one more: Two circle insect inside a large circle.
•  » » » » » 9 months ago, # ^ |   0 It seemed that one really had to implement the 100 case-handling solution.
 » 9 months ago, # | ← Rev. 2 →   0 My div2B has been hacked twice,because I regarded the parameter as 34 & 38.I really want to cry.
•  » » 9 months ago, # ^ |   0 In the last moment before submitting I changed 36 to 34. Locked the solution briefly after. The next moment I realized I'm f***ed. The right thing to do was to hack myself, but I lost that opportunity.
•  » » » 9 months ago, # ^ | ← Rev. 2 →   0 Sad story.
•  » » » 9 months ago, # ^ |   0 can you really hack yourself?
•  » » » » 9 months ago, # ^ |   0 I have read somewhere in the comments that it is possible. Haven't tried though.
•  » » 9 months ago, # ^ |   0 I thought 1e18 had 18 digits -_-
•  » » » 9 months ago, # ^ |   0 Me too.
 » 9 months ago, # |   +1 What is the easiest solution for div1 C?
•  » » 9 months ago, # ^ |   +19 Euler's formula.
•  » » » 9 months ago, # ^ |   +1 What's the value of V and E in Euler's formula if there is only one circle (or two circles not intersecting with each other)?
•  » » » » 9 months ago, # ^ |   0 You can think of a single circle as a vertex with an edge to itself, or 2 vertices with 2 edges between them. In any way, it has V = E.
•  » » » » » 9 months ago, # ^ |   0 But if V = E, from R + V - E = 2 we have R = 2. This is correct when there is only 1 circle, but it's incorrect when there are 2 circles not intersecting with each other (R should be 3).
•  » » » » » » 9 months ago, # ^ |   +27 Euler's formula works for connected graphs only.
•  » » » » » » 9 months ago, # ^ |   +6 Euler's formula is V - E + F - C = 1, where V is number of vertices, E is number of edges, F is number of faces, C is number of connected components.
 » 9 months ago, # |   0 Very nice contest for DIV.2! All 5 problems are solvable, and many hacks on A, B. I was late to contest half an hour, but hopefully nobody was checking for hacks on B until that time.
 » 9 months ago, # |   0 Div2E: Can any one сonfirm that there is no such test in pretests? 3 0 0 1 3 0 1 6 0 1 Answer should be 4
 » 9 months ago, # |   +5 Contest time was too dificult for me to participate, because it was 7:05 AM in my country, toooooo early ;-(, I was in REM 27 at that time. I think contests need to be scheduled in an hour more accesible to all the world.
 » 9 months ago, # | ← Rev. 2 →   +5 Problem E Div2 / C Div1: Is there any tricky cases other than this one: 3 0 0 5 -3 0 4 0 -4 3 Answer should be 7
•  » » 9 months ago, # ^ |   0 For me every case is tricky :D For example all three circles have one different common point, or two circles are inside the third one.
 » 9 months ago, # |   +8 I lost 1200 points in the last 20 minutes. Maybe i will never be able to participate Div.1. QAQ
•  » » 9 months ago, # ^ |   +11 Don't lose heart, welcome to fight together to get a purple name :D
•  » » » 9 months ago, # ^ |   +8 Thanks~n(*≧▽≦*)n
 » 9 months ago, # |   +7 Anyone else thought the subsequences in div2 C had to be contiguous? I should really start reading statements more carefully...
•  » » 9 months ago, # ^ |   0 I feel your pain :>
•  » » 9 months ago, # ^ |   +5 wasted 40 minutes on this too. you are not alone :)
•  » » 9 months ago, # ^ |   0 Thank god i'm not alone :D :D
 » 9 months ago, # |   0 In div2 B for k=39 answer can be 000888888888888888888 is it right?
•  » » 9 months ago, # ^ |   0 There shouldn't have any leading zero.
•  » » » 9 months ago, # ^ |   0 but my answer is positive and has 39 loops
•  » » » » 9 months ago, # ^ |   0 But that is not a correct digits' decimal representation,right?
•  » » » » » 9 months ago, # ^ |   0 maybe
•  » » » » » 9 months ago, # ^ |   0 yes u are right else i can just print k 0's
•  » » » » » » 9 months ago, # ^ |   0 However,k 0's is not a positive number:D
•  » » » » » » » 9 months ago, # ^ |   0 i mean k-1 0's and 4
•  » » » » » » » » 9 months ago, # ^ |   0 Yes,I understand:D
•  » » » 9 months ago, # ^ |   0 by the way Happy New Year
•  » » » » 9 months ago, # ^ |   0 Happy New Year for you too.
 » 9 months ago, # |   +5 Why cannot I understand Div.2 D(Div.1 B)......It seems that there isn't any requirement on q(x), but if q(x) has infinite number of coefficients(in other words ), then it looks like there always exists a q(x) whatever f(x) is.(I took f(x) = x for example and it didn't seem wrong)So how to explain that? Or am I really wrong?
•  » » 9 months ago, # ^ |   0 Polynomial always have limited number of coefficients, that's the point. Polynomial with infinitive number of coeff. calls sequence.
•  » » » 9 months ago, # ^ |   0 Oh, I see......It's likely that I'm misled by the paper of matthew99(in fact it's I that treat polynomial as sequence)Thanks a lot.
 » 9 months ago, # | ← Rev. 2 →   0 Why if we need 1 loop in problem B, '0' gets WA, and Accepted on pretests with '6'.
•  » » 9 months ago, # ^ |   0 the output should be >0
•  » » 9 months ago, # ^ |   0 The problem requires print a possible integer, zero is not negative and not possible. Therefore, zero is Wrong
•  » » » 9 months ago, # ^ |   0 Oh, Thanks.
 » 9 months ago, # | ← Rev. 3 →   +71 Div 1 C is the worst problem that can be proposed for a cf round, not only it can be found in various sources but also it only requires to just check some cases instead of the general case. D and E are good on the other side...
•  » » 9 months ago, # ^ |   +21 You can write a solution for general case, and I don't think that it is much harder. What is your problem with case analysis tasks? But I definitely agree that copying task from Timus is bad.
•  » » » 9 months ago, # ^ | ← Rev. 2 →   +13 When you need to analyse cases in a general problem it's good but when in a particular case I don't think it deserves to be C.Also, it isn't only on timus...
•  » » » 9 months ago, # ^ | ← Rev. 2 →   +52 This problem is prepared by me and I must apologize that this problem coincide with some problem elsewhere.I came up with this idea these days and found it hard to discuss all the cases even if n = 3. So I think it is interesting to leave it as a problem with some hacks, instead of a problem in general case (seems luckily that I haven't did so). However, none of us writers or tester realized that this problem is a special case for an original problem.When I saw you passed this problem in 3 mins, I knew things go wrong but can do nothing. But I am still so sorry for that.
•  » » » » 9 months ago, # ^ |   +6 Actually you do not need to worry about it :) It is important only for 30-40 users, for all others that is not big deal ( it is true that is the 40 users with highest rating, but still it is not so big disaster ).Hope to see more your rounds !
•  » » » » » 9 months ago, # ^ | ← Rev. 3 →   +29 Well... thanks for your approval. But for me it is really an issue, which makes me feel upset instead of delighted for such an interesting(?) task. It seems that my hard works, especially generating some tricky cases by hand, for this problem are in vain.
•  » » » » » » 9 months ago, # ^ |   +4 But... It's harmful for other participants. Because it's just after two very simple problems, a lot of people solved A and B in about twenty or thirty minutes. You see, div.1 D is super easy to code, and not difficult to think(just a few sigmas). But when I saw a lot of people passing C in 5 min(even 2), I spent one and half an hour thinking problem C. So I don't think it's good to make this round completely rated. Maybe unrated or semi-rated is a good choice?
•  » » » » » » » 9 months ago, # ^ |   +6 As you can see, all of us writers and tester didn't notice that. I must admit that it is also a part of ability to realize the original problem. Making this round unrated or semi-rated will be unfair to those who solved the problem by copy-pasting.
•  » » » » » » 9 months ago, # ^ |   +3 At least you did good job with testcases ! More than 100 solutions got WA at final testing, also div 1 users got chance for hacking something during the contest.Still I do not like task :P But I do not think you done so bad job !
•  » » » » » 9 months ago, # ^ | ← Rev. 4 →   0 Not only for reds, for example 6 people from my country solved it without even knowing the solution (the judge from the link above has public codes). I don't want to blame the author, it's just that codeforces needs testers from different regions.
•  » » » » » » 9 months ago, # ^ |   0 I wrote first that I do not like task, so I am completely agree with you !But I want to say I saw a lot of worse contests in last year than this one :)
 » 9 months ago, # |   +5 What do you have on the following test for d1C? 3 -5 0 10 0 0 5 5 0 10 
•  » » 9 months ago, # ^ |   +11 6
 » 9 months ago, # |   +5 Are there anybody who solved D without expanding the formula?
 » 9 months ago, # |   +102 It's so funny when people who get high places are the ones who actually manage to quickly copy their sources off of other online judges to submit in this round. No hate.
 » 9 months ago, # |   0 The gift from TeacherQ has receivedQwQ
 » 9 months ago, # |   0 In div2 C, what does it means to reverse the subsegment? flip all 1 to 2 and 2 to 1 or std::reverse(l, r)?
•  » » 9 months ago, # ^ |   +3 In my opinion it's probably the latter.
•  » » 9 months ago, # ^ | ← Rev. 2 →   -13 It's first i.e flip all 1 to 2 and 2 to 1.
•  » » » 9 months ago, # ^ |   0 No. It's reverse.
•  » » » » 9 months ago, # ^ |   0 sorry then, I misunderstood.
 » 9 months ago, # |   0 I made a typo and still passed pretests for problem A div2
•  » » 9 months ago, # ^ |   +15 Pretests are always too weak...
•  » » 9 months ago, # ^ |   +3 exactly the same typo for me, too. So I wasn't the only one who failed systest with bruteforce solution
 » 9 months ago, # |   -6 not a standard contest at all!!!
 » 9 months ago, # |   0 I have received teacherQ's new year gifts.
 » 9 months ago, # |   +74 At contest![ ]()
 » 9 months ago, # |   +54 Codeforces community
 » 9 months ago, # |   +125 I enjoyed this contest so much that now I suggest to introduce new contest type. The main goal is to find out, where you saw such problems and then use copy-paste technic to solve them.
•  » » 9 months ago, # ^ |   +12 I know C today is bad, but come on, other problem is not that terrible.
•  » » » 9 months ago, # ^ |   +15 Ok, you are right, however it doesn't change the fact that even one bad problem can ruin the whole contest, and so the problem C did today.
•  » » » 9 months ago, # ^ |   -9 Div2. A and maybe B were terribble!
•  » » » » 9 months ago, # ^ |   +17 if u can't solve a problem it doesn't mean that it's terrible or something ...
•  » » » » » 9 months ago, # ^ | ← Rev. 2 →   0 and if u solved some problems doesn't mean that they're not terrible:)...you can just compare these problems with some other contests to understand my talking...
•  » » » » » » 9 months ago, # ^ |   0 I don't have any problem with div 2 A or B ... :)what was your problem with them which made you say there are terrible ?! ;)
•  » » » » » » » 9 months ago, # ^ |   0 they're ridiculous problems, and both were just implementation problems and have nothing to think aboutgetting point from this kind of problems in the contest's needs high precision and chance!
•  » » » » » » » » 9 months ago, # ^ |   0 I'm not agree with u, A good competitive programmer should be able to solve any kind of problems in contests ;)you can't find any comment from top coders like tourist or ... that saying some problem is terrible or something else ... work on your coding skills and don't complain with others :)
•  » » » » » » » » » 9 months ago, # ^ |   0 yes exercising is so important but i don't waste my time to solve A , B problems that have nothing to teach me...any way these problems were terrible ;)
•  » » 9 months ago, # ^ |   +17 So your solution from Timus is wrong or what? :)
•  » » » 9 months ago, # ^ |   +13 I just wrote another one((
•  » » 9 months ago, # ^ |   +13 BTW, there already exist contests of that type. SnarkNews [season] Series, for example.
 » 9 months ago, # | ← Rev. 2 →   +1 I miss when pretests' sole purpose was to decrease the load on the servers during the contest. Now it's just some additional hidden samples.
 » 9 months ago, # |   +30 Why is CF-Predictor not working?
 » 9 months ago, # |   -6 My friends (and I) with Div2E/Div1C...Hope that the editorial for this problem will be something genius...
•  » » 9 months ago, # ^ |   +19
•  » » » 9 months ago, # ^ |   +9 Did anybody manage to pass this using Monte Carlo sampling and DFS?
•  » » » » 9 months ago, # ^ | ← Rev. 4 →   +23 Probably not. Some of the testcases have an extremely small part, with an area less than 1e-6.upd: It's testcase 113, here is the plot --> http://www.wolframalpha.com/input/?i=plot+(x%2B4)%5E2%2B(y%2B2)%5E2%3D81,(x-8)%5E2%2B(y-4)%5E2%3D81,(x%2B10)%5E2%2B(y-10)%5E2%3D100http://www.wolframalpha.com/input/?i=plot+(((x%2B4)%5E2%2B(y%2B2)%5E2%3D81,(x-8)%5E2%2B(y-4)%5E2%3D81,(x%2B10)%5E2%2B(y-10)%5E2%3D100),(-0.69%3Cx%3C-0.68,6.36%3Cy%3C6.37))
•  » » » 9 months ago, # ^ |   0 I'm still not getting it. I know the theorem, but how to set it up with a plot full of circles? (and to top it all off, many curves between two points may be formed)
 » 9 months ago, # |   +113
•  » » 9 months ago, # ^ |   +20 what if i solved and proved it 7 years ago?
 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # | ← Rev. 2 →   0 What is the solution for Div2C?
•  » » 9 months ago, # ^ |   0 i solved using dynamic programming.
•  » » » 9 months ago, # ^ |   0 Could you please explain your solution?
•  » » » » 9 months ago, # ^ | ← Rev. 5 →   +15 My approach for Div2C:It is easy to identify that, all the possible non-decreasing subsequences will be one of the following type:1. Starting with 1 and ending with 12. Starting with 1 and ending with 23. Starting with 2 and ending with 2. Now for each pair (i, j), we want to find the length of each type of non-decreasing subsequence and we can keep the length of the largest. We have two arrays, dp[i][j][k] storing size of largest non-decreasing subsequence of each type [k], in subarray [i...j] and reverse_dp[i][j][k] for reversed [i...j].k = 0 stores maximum subsequence of type 1, k = 1 stores maximum subsequence of type 2 and k = 2 stores maximum subsequence of type 3. if(arr[j] == 1){ dp[i][j][0] = dp[i][j-1][0] + 1; dp[i][j][1] = dp[i][j-1][1]; dp[i][j][2] = dp[i][j-1][2]; } else{ dp[i][j][0] = dp[i][j-1][0]; dp[i][j][1] = max(dp[i][j-1][0], dp[i][j-1][1]) + 1; dp[i][j][2] = dp[i][j-1][2] + 1; } Similarly we can store data for reverse subarrays.Now, we want to find answer when we are reversing subarray [l...r]. We break this array in three parts [0...l - 1], reverse of [l...r], [r + 1...n - 1]. We can form each type of subsequence by given data.Type two subsequence can be formeb by.. [Type 1] + [Type 1] + [Type 2] [Type 1] + [Type 2] + [Type 3] [Type 1] + [Type 3] + [Type 3] [Type 2] + [Type 3] + [Type 3] We can calculate size of these subsequences by using dp and the reverse_dp.This is the link to my solution.
•  » » » » » 9 months ago, # ^ |   +6 [Type1] + [Type2] + [Type2], I don't think this would be there. All the possible options can be — [Type1] + [Type1] + [Type1] [Type1] + [Type1] + [Type2] [Type1] + [Type2] + [Type3] [Type1] + [Type3] + [Type3] [Type2] + [Type3] + [Type3] [Type3] + [Type3] + [Type3]
•  » » » » » » 9 months ago, # ^ |   0 Oh, yes. You are right. Thanks for the correction.
•  » » » » » 9 months ago, # ^ | ← Rev. 2 →   0 int mx = max(dp[0][n-1][0], max(dp[0][n-1][1], dp[0][n-1][2])); for(int i = 0; i < n; i++){ for(int j = i; j < n; j++){ int a0, a1, a2; if(i == 0) a0 = a1 = a2 = 0; else a0 = dp[0][i-1][0], a1 = dp[0][i-1][1], a2 = dp[0][i-1][2]; int b0 = rdp[j][i][0], b1 = rdp[j][i][1], b2 = rdp[j][i][2]; int c0, c1, c2; if(j == n-1) c0 = c1 = c2 = 0; else c0 = dp[j+1][n-1][0], c1 = dp[j+1][n-1][1], c2 = dp[j+1][n-1][2]; int d0 = a0 + b0 + c0; int d1 = a0 + b0 + c1; d1 = max(d1, a0 + b1 + c2); d1 = max(d1, a0+b2+c2); d1 = max(d1, a1+b2+c2); int d2 = a2 + b2 + c2; mx = max(mx, max(d0, max(d1, d2))); } }@sak3t can you please elaborate this part little more?
•  » » » » » » 9 months ago, # ^ |   +4 In the last for loop, we are taking subarray A[i...j], and we are finding length of largest subsequence of each type in A[0...l - 1], reverse of A[l...r] and A[r + 1...n - 1]a0, a1, a2 store length of largest [Type 1] subsequence, [Type 2] subsequence and [Type 3] subsequence respectively for A[0...l - 1].Similarly, b0, b1 and b2 store length of each kind of subsequence in reverse of A[l...r].Similarly for A[r + 1...n - 1], in c0, c1, c2 Now we want to calculate maximum length of each type of subsequence in d0, d1, d2 in A[0...l - 1] +  reverse(A[l...r]) + A[r + 1...n - 1].We can create [Type 1] and [Type 2] subsequence easily. Look at the explanation above for how to calculate d1, and then we take the maximum of these three length.
•  » » » » » » » 9 months ago, # ^ |   0 thank you very much.
•  » » » » » 9 months ago, # ^ |   0 The same idea is giving me TLE in java. Don't know why. Here is my submission.
 » 9 months ago, # |   0 Can anybody tell me what's wrong with my solution of PROBLEM A
•  » » 9 months ago, # ^ |   0 You set initial values for fans and ans too big. Long long in C++ can only hold up to (approx.) +-9e18.
•  » » » 9 months ago, # ^ |   0 That won't be an issue.
•  » » » » 9 months ago, # ^ |   0 Yeah, the declaration of array size is wrong. But still, the wrong initialization values for those variables I think would lead to Wrong Answer, though.
•  » » » » » 9 months ago, # ^ |   +1 You're right, there may be integer overflow. But in this case, the code passed.
•  » » » » » » 9 months ago, # ^ |   0 I see, the constants are implicitly converted to the max/min value of long long.
•  » » » 9 months ago, # ^ |   0 That was indeed the issue! Thanks
•  » » 9 months ago, # ^ |   0 Here : long long a[n+1], b[n+1]; Array b should have been declared with size m+1
 » 9 months ago, # | ← Rev. 2 →   +20 Well...I have to say that it's a round full of FST....I didn't realized that there was a round here until when the round had run for 30 min..Then I tried but failed on A,then solved B immediately...It's not difficult to know how to solve C,but I coded for almost an hour...Before system test, I was #200+ but became #50 after system test..TATI have to say that it's an excellent round.Finally, Happy Lunar New Year to all the Chinese players!
•  » » 9 months ago, # ^ |   +12 what is FST?
•  » » » 9 months ago, # ^ |   +18 The short form of "Failed System Test" in China :).
 » 9 months ago, # | ← Rev. 3 →   +4 Div.2 D: Anyone here used Bezout polynomial remainder theorem? P/s: In the last 45 minutes, although I knew we have to build f(-k) = p, but I couldn't implement it :'(
 » 9 months ago, # |   +5 gimme privilege to write editorial for Div1C/Div2E: http://codeforces.com/group/qo1icaI3vI/blog/entry/1205?#comment-367474you can also copy the code and paste exactly from gym with coach mode (sorry div2 poor you)
 » 9 months ago, # |   0 plz provide editorial
 » 9 months ago, # |   -33 I have to say, this wasn't a nice cf round. It's understandable that pretests in Educational rounds are weak, because those problems are a little bit easier and the main purpose of that kind of rounds is the hacking phase. But making such weak pretests in a normal cf round? Why? I love this kind of contests, but this one is the exception...
 » 9 months ago, # | ← Rev. 2 →   0 in question A;INPUT 3 3 -3 -2 -1 -2 0 1Output: -2Answer: 4why not answer is 6 ? it is the maximum
•  » » 9 months ago, # ^ |   0 Tommy hides -3 so the answer is -2 * -2 if Tommy hides another number , Banban will get -2 * -3 which is larger than 4
 » 9 months ago, # |   0 Love such rounds with a lot of hacks :-) the best present for Valentine's day. :roffle!
 » 9 months ago, # |   0 Hey guys,Please can anybody tell me the correct answer for input of problem A Div1:2002 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 1 1 1 2 1 1 2 2 2 2 2 1 1 2 1 2 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 1 1 2 2 2 1 1 2 1 2 1 2 1 2 2 1 1 1 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 1 1 1 1 2 1 2 1 1 1 2 1 2 2 2 1 2 1 1 1 1 1 1 2 1 1 2 2 2 1 2 1 1 1 1 2 2 1 2 1 2 1 2 1 2 1 2 2 1 1 1 1 2 2 1 1 2 2 1 2 2 1 2 2 2thank you!
•  » » 9 months ago, # ^ |   +5 The answer is 116.
•  » » » 9 months ago, # ^ |   +16 I did not notice it is non-continuous subsequence :(
 » 9 months ago, # | ← Rev. 2 →   +5 How to solve Div.1 A in O(n)?
•  » » 9 months ago, # ^ |   +15 You can do a dp using current element, value of last, and the current state (non decresing, non incresing and non decresing again) [n][2][3]. This part that we'll reverse is the part that we consider non incresing
•  » » » 9 months ago, # ^ |   0 Thanks a lot.
 » 9 months ago, # | ← Rev. 2 →   -11 codeforces problem is like you can do both hack and AC..
 » 9 months ago, # | ← Rev. 3 →   0 can someone please help me with my code for DIv2C : https://ideone.com/Nd1oiyIt's an O(N^2) solution but it gives me TLE on test 11!Edit : please don't mind. I am thinking totally wrong.
•  » » 9 months ago, # ^ |   0 Its not O(N^2). You call rev() function into two for loops and every time you call a for loop in rev(). That means 3-nested loops. So its O(N^3)
•  » » 9 months ago, # ^ |   0 Your solution is not O(n2), it goes to O(n3) as for each pair (i, j) you are swapping times. So each pair will be O(n2) and for this you are going at max on average n/4 times, hence O(n3). Correct me if I am wrong.
•  » » » 9 months ago, # ^ |   +4 oh sorry! Please don't mind.
 » 9 months ago, # |   0 For Div. 2 D, I could reach the conclusion that p must be in the form of a0 - a1 * k + a2 * k2 - a3 * k3..... + ( - 1)n * an * knHow do I move ahead from this conclusion? Is there a theorem or property that I am missing? Please guide. Thanks.
•  » » 9 months ago, # ^ |   +13 Now you are trying to represent p as a base (-k) integer.
•  » » » 9 months ago, # ^ |   0 Seems like I need to go back and revise basics of number theory. I had no clue that a number can be written in (-k) base. >_<. Thanks anyway.
 » 9 months ago, # |   0 The reason why I don't need a valentine. :PCodeforces is already my <3
•  » » 9 months ago, # ^ |   0 Congratulations. :P
•  » » 9 months ago, # ^ |   +3 Great hacking today!
•  » » » 9 months ago, # ^ |   +1 Thanks and sorry.. :)
•  » » 9 months ago, # ^ |   0 rating is a measure of happiness for you? poor man..
 » 9 months ago, # |   0 Failed 1C due to the floating point precision error...
 » 9 months ago, # |   0 Can someone explain why my solution for Div2A failed on testcase 10 35279033My solution is :1-Sorting both arrays ascendant2-check if the last element in Big Banban's array is positive then i will check for the element tommy[n-2] if its negative answer will be cout << '-' << (ll) (abs(x[n - 2]) * (ll) z[m - 1]);if it positive answer will becout << (ll) (x[n - 2] * (ll) z[m - 1]);and same as if Big Banban is negative
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 In testcase 10 Tommy has 50 negative numbers and Banban has 50 positive numbers.so Banbans strat is to pick numbers with lowest absolute value, because product is guaranteered to be negativebut you pick the num with largest abs from Banban's numbersp.s. by the way, this problem is relatively complex until you make a key observation: the input set is so small that you can just brute force all the combinations
•  » » » 9 months ago, # ^ |   0 Yea thanks i got it.
 » 9 months ago, # | ← Rev. 4 →   -10 Good Time For All!
 » 9 months ago, # |   0 Auto comment: topic has been updated by Tommyr7 (previous revision, new revision, compare).
 » 9 months ago, # |   +2 Thanks to your fantastic tasks, I could finally go into a new year with a new rating and a new color.
 » 9 months ago, # |