PrinceOfPersia's blog

By PrinceOfPersia, history, 3 months ago, In English,

Hello Codeforces, and happy Nowruz.

It's an honor to announce you that Codeforces Round #406 is going to take place on March 23rd.

I'm the writer of this round and it is gonna be my 6th CF contest (there are still plenty coming...). There are 5 problems and you'll have 120 minutes to solve them.

I'd like to thank keyvankhademi and waterfalls for testing this round, netman and KAN for helping me prepare this round and MikeMirzayanov for awesome platforms of Codeforces and Polygon.

The main characters of this round are going to be Rick and Morty!!!

Scoring will be posted soon.

Problems are sorted by their expected difficulty, but I strictly recommend you to read all the problems.

GL & HF!

P.S: Top IOI 2017 participant in each division (only with handle present in the future IOI handle list) will be rewarded with special Persian souvenirs in Tehran.

UPD: Scoring distribution is: 500, 1000, 1750, 2000, 2500 for Div.2 and 750, 1000, 1500, 2000, 2500 for Div.1

UPD: Editorial is out!

UPD: System test is over, congratulations to the winners.

Div.1 winners are:

  1. moejy0viiiiiv
  2. Um_nik
  3. LHiC
  4. -XraY-
  5. ershov.stanislav

Div.2 winners are:

  1. xumingkuan
  2. HXLLL
  3. Rpd-Strike
  4. U6121071173
  5. VoteBanned

See you next time ;)

 
 
 
 
  • Vote: I like it  
  • +493
  • Vote: I do not like it  

»
3 months ago, # |
  Vote: I like it +86 Vote: I do not like it

amd is back! <3

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Something, I have heard of being a great experience but never experienced is happening. It's happening, happening. A contest worth it, as others say. :)

»
3 months ago, # |
  Vote: I like it +20 Vote: I do not like it

Amd's contests are so good. I've never been disappointed with any of his contests. Looking forward to this Thursday.

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

are you sure then IOI participants has in EACH division?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    You would be surprised, but as far as I remember the split was 50 / 50 for those with a Codeforces account.

»
3 months ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

"I strictly recommend you to read all the problems" does that related to the difficulty of the upcoming problems???

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    read this

  • »
    »
    3 months ago, # ^ |
      Vote: I like it -15 Vote: I do not like it

    From quite an experience , I believe , the statement wants to convey that C can might turn out to be easier than B :P

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +17 Vote: I do not like it

    For example, you are very good at math and E is math problem which you can solve, but you are solving A-B-C and can't solve D, so you can think if I can't solve D, I won't solve E too and don't reading problem. So, it is good to read all the problems.

»
3 months ago, # |
  Vote: I like it +54 Vote: I do not like it

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Will be using this when code fails system tests :(

»
3 months ago, # |
  Vote: I like it +19 Vote: I do not like it

»
3 months ago, # |
  Vote: I like it +21 Vote: I do not like it

Happy Nowruz! I wish everyone that the round was truly festive!

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I missed PrinceOfPersia's rounds so much!

»
3 months ago, # |
  Vote: I like it +12 Vote: I do not like it

(only with handle present in the future IOI handle list). Where's that list?

»
3 months ago, # |
Rev. 2   Vote: I like it -25 Vote: I do not like it

Problems are sorted by their expected difficulty, but I strictly recommend you to read all the problems.

GL & HF!

// What's the output of this code ? :)

cout<<(GL=="Good Luck" && HF == "Have Fun" ? "Yes":"No");
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

»
3 months ago, # |
  Vote: I like it +74 Vote: I do not like it

"Do ya hear that M-M-Morty? *URP* We're gonna go to a universe where everyone is a character in a programming competition, Morty--"
"I-I, uh, I don't know Rick, that sounds like--"
"A programming competion, Morty! Codeforces, Morty!"

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Hope morty doesn't go back to the old shop... :/

»
3 months ago, # |
  Vote: I like it +48 Vote: I do not like it

Good Luck and Have Fun !!

I hope this comment becomes the reference for all authors who are lazy to write it , and they write GL or HF . so they can copy paste it from here .

»
3 months ago, # |
  Vote: I like it -10 Vote: I do not like it

First of all I apologise to write it here as I am very much new to this.I want to hack a problem which is already accepted.But I can see that the solution is wrong,what to do,Please Help.

»
3 months ago, # |
  Vote: I like it -11 Vote: I do not like it

»
3 months ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

AMD setting the round + Main characters as Rick and Morty. This is going to be good.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    do not be so sure until you see the mromlems

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

A contest about me? thx :D

»
3 months ago, # |
  Vote: I like it -18 Vote: I do not like it

wowwww im very much excited about the contest ... for giving this contest i will eatless :) hoping for +ve rating change and i love all the contest prepared by princeofpersia ... and i love him too :) his style of blog writing is awesome and he is also awesome... i love codeforces ,,,,, i love MikeMirzayanov and i love alll :) happy coding best of luck for the contest :D

»
3 months ago, # |
  Vote: I like it +55 Vote: I do not like it

What made you change your mind?

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

I just love codeforces contests

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Best theme ever! This is one of the main reasons for why I love competitive programming...

»
3 months ago, # |
  Vote: I like it +41 Vote: I do not like it

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

..

»
3 months ago, # |
  Vote: I like it +22 Vote: I do not like it

Why the hell your characters are soooooooooooooo intresting?! 1-Barney Stinson 2-Mike 3-Rick and Morty all of them are wonderful

»
3 months ago, # |
  Vote: I like it -19 Vote: I do not like it

can someone tell me the full-form of amd please?

»
3 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Do i only see that i have last 2nd contest's amount of points instead of amout that should i have now? I mean i have 1021 when i had after last round 1087 and i see everybody have the same issue

Also my submissions from last contest got back themselves

»
3 months ago, # |
  Vote: I like it +25 Vote: I do not like it

Glad to see my teacher is holding another round, good luck PrinceOfPersia (reply to this comment).

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Happy Nowruz everyone) Hope that most will increase their rank

»
3 months ago, # |
  Vote: I like it -49 Vote: I do not like it

Everybody, who liked this commend will increase his rating))

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +133 Vote: I do not like it

    *no one upvotes and thus your statement is true*

»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Good thing CodeForces doesn't have verdict "Not Acceptable", else this round will be full of Error 406: Not Acceptable.

»
3 months ago, # |
  Vote: I like it +43 Vote: I do not like it

It's my birthday contest !! thanks PrinceOfPersia :D

»
3 months ago, # |
  Vote: I like it -16 Vote: I do not like it

Yeahhh !!! More contest for me to decrease my rating

»
3 months ago, # |
  Vote: I like it +173 Vote: I do not like it

Guys, better prepare robust version of Heavy-Light Decomposition. Afair on 3 out of 5 PrinceOfPersia's contests E required it xD.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +48 Vote: I do not like it

    Thanks, I will Unregister!!!

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +232 Vote: I do not like it

      Yeah, possibility of Div1E being HLD is a perfectly valid reason for greens to unregister ;p.

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 5   Vote: I like it +35 Vote: I do not like it

        I understand Sarcasm.Thanks

        If E is HLD,then Accordingly all lower problems like D will be of PersistenSe segTree amd c will be of Sqrt decomposition and b will be of Dynamic programming with bitmasking and A will be of Maximal fLow and minimum cut in graph and Div2B will be from suffix trie and then DIV2a will be Unknown theorems on NUmber theory .So,I said I will Unregister

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it +144 Vote: I do not like it

          If E is HLD,then Accordingly all lower problems like D will be of PersistenSe segTree amd c will be of Sqrt decomposition and b will be of Dynamic programming with bitmasking and A will be of Maximal fLow and minimum cut in graph and Div2B will be from suffix trie and then DIV2a will be Unknown theorems on NUmber theory .

          That's a pretty good and valid point.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +50 Vote: I do not like it

    Funny fact: in Round #362 problem E was not a hardest problem, but it was indeed a HLD-problem. So, if a problem on HLD appears, it will apparently be the problem E, no matter how many problems in the contest there are.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +46 Vote: I do not like it

      On last Petrozavodsk I used HLD once and it was also problem E (E2) :D. Apparently it was second easiest problem that day xD.

»
3 months ago, # |
  Vote: I like it -176 Vote: I do not like it

you cock sucking son of a faggot gay piece of a homo sexual fucking mama joon (go see deadpool for more information) contest writer

»
3 months ago, # |
  Vote: I like it -144 Vote: I do not like it

who likes inception?

»
3 months ago, # |
  Vote: I like it -36 Vote: I do not like it

hahaha :-D

Nice photo Prince :-D

»
3 months ago, # |
  Vote: I like it -162 Vote: I do not like it

fact : PrinceOfPersia is a gay prince and he's trans.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it -24 Vote: I do not like it

    So?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      amirp78 the only thing we all know here is sir princeofpersia is a great coder and motivation of all of us . His problemsetting is awesome :) and his contest are always interesting , so focus on that fact !!! :)

»
3 months ago, # |
  Vote: I like it -30 Vote: I do not like it

Wow...its great

»
3 months ago, # |
  Vote: I like it -33 Vote: I do not like it

Hi, Prince)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

mrims of persia always very nice mromlems, looking forward to the round 406, good luck

»
3 months ago, # |
  Vote: I like it -28 Vote: I do not like it

Me when the competition starts (better watch out!)

»
3 months ago, # |
  Vote: I like it +13 Vote: I do not like it

Scoring distribution?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I didn't know the theme was Eminem too

»
3 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Hacking page does not load.

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

EM fan eh ?

»
3 months ago, # |
  Vote: I like it +26 Vote: I do not like it

Did anybody notice the names of the problems...they are the names of eminem's songs too.

Nice taste PrinceOfPersia.

:)

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Very long queues.

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Is there a long hack queue? My hack has been in queue for almost 5 minutes now

»
3 months ago, # |
  Vote: I like it +69 Vote: I do not like it

This is exactly how I read the problem statements to understand the whole meanings.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

If suppose somebody program is write but would terminate before considering all the inputs would it be a valid program or not?

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

It could be better if there were explanations for the examples in Div 2 problem C. It is possible to understand it ambiguously.

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Systests of A will make many people sad (me too) :'(

»
3 months ago, # |
  Vote: I like it +34 Vote: I do not like it

Like almost everyone after the contest

»
3 months ago, # |
  Vote: I like it +35 Vote: I do not like it

Div 2 B and C are so ambiguous. There should be more explanation rather than what we had.

»
3 months ago, # |
  Vote: I like it -15 Vote: I do not like it

I do really like problem C xD good job PrinceOfPersia

»
3 months ago, # |
  Vote: I like it +83 Vote: I do not like it

PrinceOfPersia right now.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve C? My idea is to do dynamic programming with 3 state [position][cycle_passed][turn], with O(k) transition. This gives the right answer, however since cycle_passed could exceed 70, my solution got TLE. Am I on the right track here?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It needs only position and turn(0 or 1), nothing else.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    I used a dp approach too, conf[player][pos] = 1 if player can win if he moves first from pos, 2 if he loses, 0 if it-s a loop. I made a dfs(player,pos) to find the answer for the current configuration but I'm not sure it will pass the main tests because of the complexity . It became a little complicated when taking care of the loops so I had to use some extra time to verify those.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What are the hack cases for problem 2 divB

»
3 months ago, # |
  Vote: I like it +10 Vote: I do not like it

Applause Great problems! Thank you, man!

»
3 months ago, # |
  Vote: I like it +5 Vote: I do not like it

on div2b, why no runtime error for negative values on this solution?

Unsuccessful Hack case

10000 2
8 1 -1 -1000 -2000 -3000 -4000 -5000 -6000
8 1 -1 -1000 -2000 -3000 -4000 -5000 -7000

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Could you show the whole code?

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      sure: submission

      it received WA on systest, but I was wondering why the hack didn't pass

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it +4 Vote: I do not like it

        If you add cout << ok << " " << v << endl; to the beginning of code: You get 0x554ae0 0x4f3040. That means that ok was placed after v (exactly v + 100008 = ok), so in fact ok[-1000] makes sense because it means v[100008 - 1000] (Don't have any idea why 100008 and not 100005, that's some compiler stuff).

        But generally you could get a Succesful hack by this test:

        10000 2
        3 1 -1 -10
        1 10
        

        He wouldn't clear ok[10] after first group, so he will say "NO" after checking 2nd group and finding that there are two elements with absolute value of 10. But right answer is of course "YES".

        Also this code doesn't check multiple occurrences of the same element. So

        1 1
        2 1 1
        

        will also have "NO" answer, but the right answer is "YES".

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I see, so it doesn't give RE only because that memory region is luckily located within the program scope. Well, at least it didn't pass the systest. Thanks for the clarification, it was very helpful!

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Whats the hack for div 2 A?

»
3 months ago, # |
  Vote: I like it +5 Vote: I do not like it

10000 1 2 -3 -3

So many fell to this single test in div 2 B :-P..

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Was it possible to solve Div2.D on Python? I tried all my best, and solution is very simple, but Timeout on pretest 8...

»
3 months ago, # |
  Vote: I like it +171 Vote: I do not like it

I couldn't really understand the statements. I read problem A like 5 times.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i read it like 20 times til i understand it

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I can't still figure out what I should do. Can somebody explain the statement to me? TT

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      they are moving the same monster alternatively, I read it more than 10 time to figure that out :(

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      in simplified version, you and i takes turn alternately and choose some number from our set

      my set = {4,3} your set = {2,5,3}

      let x be the initial position of the monster and i were about to move first

      your task is not to make the monster went to the blackhole, and my task is to do so. for example N = 5 and x = 2, and i choose to move 4 steps ahead which makes the x = 1 (circular) then i win, in other case i can move 3 steps which makes the x = 5 and you takes the turn to make sure i can't make the monster into the blackhole

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      Well you have an infinite game, you have a position and turn. In your turn you take any of your numbers and change position into (position + chosen_number) % n. If you got into 0 -- you win.

»
3 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

I think problem E was just a persistent segment tree .Let A be the original array. Make a persistent segment tree B such that position j of the i'th version is 1 if there is no value equal to A[j] between A[i],A[i+1],....,A[j-1]. Once we have this we can do a greedy construction, because we can find the farthest possible endpoint for the next segment in time log(n).

Is this the intended solution?

»
3 months ago, # |
  Vote: I like it +11 Vote: I do not like it

B was easier than A

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Just 10 more seconds ... (and a faster Internet)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Pretty nice contest (although I failed).

B was really nice but I didn't like A.

On C can I coded a solution (which I thought was and I still think so) the idea was that you change the answer at most when you change the K. Also the answers are decreasing so we can do a divide and conquer with at most times computing/doing the O(N) solution for fixed K. Can someone provide a test case which fails that, because it TLEd?

Also how to solve D?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is O(n * log23(n)) the intended complexity for C?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Nope

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Then can you give me some hint how to improve this? I used binary search + Persistent IT.

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Greedily do for K = 1 — 1000 in O(n). Now notice that for K > 1000, answer will be <= 100.

        Binary search on the range to get answers that lie b/w x for x from 100 to 1.

        For a single x it will take at max O(logn*100*logn*logn) This passes for me in < 1 sec

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Yes I done on the similar way.

          First I found article where I read problem with amount of distinct numbers online in O(log n) per query and used existing code. Saw it is not enough to pass testcases, so I calculated first sqrt(N) values before binary search :)

          Other time at the round I spent in reading first problem :D

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    my solution is n^2, although I don't know if it a solution quite yet.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I got TL8 with O(n log^3 n)

»
3 months ago, # |
  Vote: I like it +16 Vote: I do not like it

i think it was very hard round for DIV2 , am i right or not ?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I tried div1 C O(n * sqrt(n)) but it has TLE. Hahaha....

»
3 months ago, # |
  Vote: I like it +86 Vote: I do not like it

I hope 2*10^4 dfs in problem D will fail? In other case I don't understand why it's D. I decided to look at the submitted solutions and it made me sad.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +117 Vote: I do not like it

    6848 ms!!! Great! Awesome problem...

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +155 Vote: I do not like it

      Awesome problem!

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I'm sorry, our best naive solution worked in 14s. I can't find any counter-test for moejy0viiiiiv's solution :-(

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it +57 Vote: I do not like it

        He just compressed dfs-es in one in order to jump less over the memory. Actually, that's the usual problem with solutions like O(n*log^10).

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yeah, more awesome because so far it is the only accepted solution.

»
3 months ago, # |
  Vote: I like it -6 Vote: I do not like it

harder than usual but problems are so nice!

»
3 months ago, # |
  Vote: I like it +5 Vote: I do not like it

We need Nicolas Cage from National Treasure to figure out the problems' statements :( . I read the statements many times to understand the problems :(

»
3 months ago, # |
  Vote: I like it +109 Vote: I do not like it

The Russian statements look much like a result of some automatic translation: the order of words is as in English, and sometimes the meaning is messed up, too. Still possible to understand, but English version looks more readable to me. Looked way better when Codeforces had staff dedicated to translating the statements, like Delinur.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it -90 Vote: I do not like it

    There should be no Russian at all. Authors should just focus on English. Quite often there was a reverse situation when native Russian speakers didn't care enough for good english statements.

    The whole codeforces.ru should be translated into english and removed.

»
3 months ago, # |
  Vote: I like it +5 Vote: I do not like it

The problems are too hard to understand.Could you make the problems become shorter,it is unfair to poor English men...like me

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

can't figure out why my solution 25749847 for B is failing. could anyone please have a look.

»
3 months ago, # |
  Vote: I like it +36 Vote: I do not like it

Are all round prepared by PrinceOfPersia have a hard Div 1 A? Or am I too weak?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    His last contest has pretty easy Div1-A. All other problem though...

»
3 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Test Case 24?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    This question is so weird.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Try this test case : 1000 1 2 -4 -4

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Wait, what? It is said that noone can join the group more than once.

      Oh god. I got it. I should have read the text better.

      • »
        »
        »
        »
        3 months ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        no it isn't

        Ricks and Mortys have registered online in these groups. So, a person can have joined a group more than once (developer of this website hadn't considered this possibility).

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Fastest System Test ever :'D

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Statement of C and D are too hard for me to understand -_-

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

WHat is the proof Of DIV2 A ? I cant guess the impossible (-1) case . When it will be impossible ? And whats the proof ?

  • »
    »
    3 months ago, # ^ |
    Rev. 8   Vote: I like it 0 Vote: I do not like it

    What I did was to construct a set of all the remainders i.e. if (b > d) (b-d+n* a)%c and if this doesn't come to zero first but repeats then it runs till infinity therefore -1. Similarly if b <= d.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    if both guys from same planet are in the same group then that group is not the required group as both from the same planet can't be traitor at the same time

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For example:

    a = 2, b = 1, c = 4, d = 4.

    We are adding even number to odd number, so it will be odd number, but c and d are even, their sum will be even to.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    b + n * a = d + m * c
    therfore :- a * n + (-c) * m = (d — b)
    this can be solved using extended gcd. if (d — b) % gcd(a, c) != 0 then answer is -1.

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I tried Bezout's Identity for Div2A . But it failed....can anyone correct me.

Also, I can't think of when would it be -1.

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

That moment when you get div. 2 problem A wrong in system test

»
3 months ago, # |
  Vote: I like it +59 Vote: I do not like it

pretty balanced

»
3 months ago, # |
  Vote: I like it +84 Vote: I do not like it

It isn't a good idea to make Div1 A so difficult.
795 users registered for this Div1 round but only 343 made at least one submission.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +23 Vote: I do not like it

    Please say this to topcoder admins too! :P

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

This time lots of Hacks & System failures! :p

»
3 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Please Can someone tell why i got WA in Prob B ?

http://codeforces.com/contest/787/submission/25753050

///

I got accepted.

same number can come...

»
3 months ago, # |
  Vote: I like it +4 Vote: I do not like it

So easy div2 B problem, but so difficult-to-understand problem statement.

»
3 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Puzzle: Name of all problems are names of Eminem songs, except for Div.1 E. Eminem has no song named ALT, so what is the story behind ALT!?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Could you guys help me with why I got Div2B wrong?

http://codeforces.com/contest/787/submission/25748568

I think I misunderstood something.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    you should clear s after push_back

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      DIV2 B- not afraid . I solved this problem , One submission with break getting WA on test 10 but test case is too long so cant guess the bug — > WA on test 10 , Submission With break statement .

      Another same submission got AC where i just cut the break statement -> GOT AC submission without break statement .

      Can not find any short test case which will give the WA for first code .

      Here is the diifference : Difference

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Can you check this test? 10 2 3 5 -5 -5 1 3

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Awesome , I understand what is the problem . Many many thanks . The problem was that when i break middle of the input , the next input data scanned by k , so this cause mulfunction to the program . Awesome hack case . Thanks .

»
3 months ago, # |
  Vote: I like it +6 Vote: I do not like it

b should be 1500 and c 1000

»
3 months ago, # |
Rev. 2   Vote: I like it -64 Vote: I do not like it

PrinceOfPersia EVEN A BLUE CODER OR CYAN CODER CAN MAKE CONTEST WITH UNIFORMITY IN PROBLEMS LEVELS THAN THIS CONTEST.FOR EXAMPLE,TAKE SOME PREVIOUS CONTESTS

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Beautiful arts) I was enjoying this contest)

»
3 months ago, # |
  Vote: I like it +13 Vote: I do not like it

My code of div2B WA vs AC after contest
My Code failed on #59. Can someone explain me how this passed 58 test cases ! !!
My best experience in CF.... I will remember it :'(

»
3 months ago, # |
  Vote: I like it -10 Vote: I do not like it

Is it rated?

»
3 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

please i want to know something: i made this submission during the contest: http://codeforces.com/contest/787/submission/25739022 and then i made another submission in the same problem because there was something i was not sure of, the other submission was hacked, and the first submission above was counted hacked also as you see in the submission link

after the contest i submitted the above submission again exactly and it is accepeted: http://codeforces.com/contest/787/submission/25754392

is this normal ?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I'd guess a yes

    It is probably because only the last one that passed all the pretests count for the contest, so your correct submission during the contests technically did not count

»
3 months ago, # |
  Vote: I like it +15 Vote: I do not like it

A positive rating change means absolutely nothing when u know u have not done well at all in the contest. :(

»
3 months ago, # |
  Vote: I like it -23 Vote: I do not like it

Hello, I think I found a mistake in system tests in task B. Time limit is 2s and I've found the test in which solution has been executing for 2.8s but system test said that it is valid.

http://codeforces.com/contest/787/submission/25744252 the test is :

10000 1

10000 1 1 1 1 1 1 1 1... 1

  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Can anyone answer why compiler skips it? It is clearly seen that the complexity is the n^2

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    2.8s on your machine maybe, probably without -O2

    Custom Invocation 46ms

»
3 months ago, # |
Rev. 3   Vote: I like it +2 Vote: I do not like it

I was able to lock my solution after being hacked. HOW?

»
3 months ago, # |
  Vote: I like it +3 Vote: I do not like it

wasn't the character next to Rick in div1 D (Rap God) Pearl from Steven Universe?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone help me with the part B? In my system for the second test, I am getting "NO" but the codeforce system test says it prints "YES". Here is my code: 25752586

»
3 months ago, # |
Rev. 3   Vote: I like it -15 Vote: I do not like it

Gl hf

»
3 months ago, # |
  Vote: I like it -11 Vote: I do not like it

ez rated

»
3 months ago, # |
  Vote: I like it -13 Vote: I do not like it

lame af

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi guys! In the A problem, why the values of i,j should be lower then N ? There is any relation of this with diophantine equations properties?