Baba's blog

By Baba, history, 7 years ago, In English

Hello Everyone!

I would like to invite you to CodeCraft-17, which will take place on Thursday 12th January 2017, 9:05PM IST. The round will be a Div1 + Div2 combined round and is rated.

Felicity, IIIT Hyderabad presents Threads ‘17, the magnificent annual technical fest, is finally here in its 13th edition! With a plethora of intellectually engaging online contests in various fields of programming, mathematics and general knowledge, Threads is a celebration of the spirit of computing and engineering. The grand algorithmic sprint called CodeCraft, parallel programming in Kernel Cruise, mathematical enigmas in Gordian Knot, jeopardy style CTF event called Break In, overall Threads '17 has something to offer for every kind of computing enthusiast!

Codecraft Poster

I would like to thank Nikolay Kalinin (KAN) for helping us in preparing the contest,to Mike Mirzayanov (MikeMirzayanov) for the great Codeforces and Polygon platform and the Threads Team for helping in preparation of the problemset.

Prizes

  • Top 25 participants win Codeforces T-shirts.
  • Additionally, 25 randomly chosen participants from top-500 will also win a Codeforces T-shirt.

You will be given seven problems and three hours to solve them. The scoring distribution will be announced later. Good luck everyone!

UPD: The constraint of registration for eligibility to prizes has been removed. Everyone who participates in the round is eligible for prizes. Sorry for the inconvenience caused!

UPD2: Scoring is 500 — 1000 — 1500 — 2000 — 2500 — 2750 — 3500

UPD3:
The contest has ended. Thank you all for participating. Hope you liked the problems.
It was our first codeforces round and it was really exciting for us to see how the contest progressed!
Editorials and list of T-shirt winners will be published soon.

Congratulations to the winners!

  1. tourist
  2. W4yneb0t
  3. anta
  4. Um_nik
  5. ershov.stanislav
  6. LHiC
  7. jcvb
  8. GlebsHP
  9. jiry_2
  10. Egor

UPD4: Editorial has been posted.

UPD5: The random t-shirts winners will be announced tomorrow according to the algorithm described in this comment.

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

| Write comment?
»
7 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it +56 Vote: I do not like it

Random --> there is a chance for Div.2 users :)

»
7 years ago, # |
  Vote: I like it +28 Vote: I do not like it

?

»
7 years ago, # |
  Vote: I like it +12 Vote: I do not like it

I hope one day i will get a T-shirt from Codeforces. that will be the best recognition of my hard work. I can't dream for a T-shirt in this round but some (+) rating.

»
7 years ago, # |
Rev. 3   Vote: I like it -35 Vote: I do not like it

randomly !! Come on there is nothing random in coding even random functions don't work randomly

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, there are some ways to generate truly random numbers :)

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +19 Vote: I do not like it

      How? And what does "truly random" even means?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it +7 Vote: I do not like it
      • »
        »
        »
        »
        7 years ago, # ^ |
        Rev. 2   Vote: I like it +5 Vote: I do not like it

        the random numbers are generated by alghorithm like von neoman or using the common method (last number generated*constant + increament) MOD m beacuse of that it's not truly random .. so the truly random numbers are the number which can really generated randomly by some way

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it -18 Vote: I do not like it

          that's what i meant and people sink me in much down vote(i don't like it)

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it -6 Vote: I do not like it

            I suppose there are 2 reasons for it: 1) Your colour. 2) What's the point of pointing that out? I am sure the words have appeared here many times before, so people here might be tired of seeing it.

            • »
              »
              »
              »
              »
              »
              »
              7 years ago, # ^ |
              Rev. 2   Vote: I like it +6 Vote: I do not like it

              aha you mean likeability and judgment.
              1)likeability: as much as you have color tends to red as much as you may be right.
              2)judgment: you probably writing that to get contribution.

              it's not facebook guys there is no celebrities her as much practicing as much tend to red & as much u help others as much u get contributions

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it +78 Vote: I do not like it

          Why are you going too far?

          We have absolute random here, You know, There's no logic behind the codeforces community's votes...

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it +29 Vote: I do not like it

            you're totally right sa1378. take my downvote

            • »
              »
              »
              »
              »
              »
              »
              7 years ago, # ^ |
                Vote: I like it +26 Vote: I do not like it

              That's the way Patrick does it ;). Upvote...

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
            Rev. 2   Vote: I like it +20 Vote: I do not like it

            huh! Not too randomized!!! Actually, the name of the writer, the color, his picture and then the comment is a little important!!! I like Sid! Upvote...!

            UPD: To be honest, my rank in the CF's contests are more randomized(*_/*)! I wrongly read a problem again and I spend much of my time on it and then, BOOOMB! Hope you read all of your problem correct!!!

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

              I like the second part of your username! upvote :))

              • »
                »
                »
                »
                »
                »
                »
                »
                7 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Clarification: "An" means "Shit" in Persian...

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

                  And It was just a mistake in my username. (~) Hope I can change it next year!!! +_+

»
7 years ago, # |
  Vote: I like it -14 Vote: I do not like it

Time to say goodbye to grey and cyan, and restore my blue color :D

»
7 years ago, # |
  Vote: I like it -26 Vote: I do not like it

Looking forward to the longer contest :)

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it -39 Vote: I do not like it

It is rated!

»
7 years ago, # |
  Vote: I like it -32 Vote: I do not like it

Longer time and fewer problems than Goodbye 2016.Wondering if the problems gonna be harder. How difficult will the problems be?

»
7 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Any past contestants of CodeCraft can measure the problems difficulty equivalent to common rounds of codeforces for newcomers?

:-)

»
7 years ago, # |
  Vote: I like it -32 Vote: I do not like it

** ** *****.

»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Here is something wrong with HTTPS certificate:

net::ERR_CERT_AUTHORITY_INVALID
Subject: felicity.iiit.ac.in
Issuer: StartCom Class 1 DV Server CA

Could you check it?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You can add an exception in your browser to access it. Our ssl certificate is issued by startcom and it might not be installed. Let me know if the issue persists.

    • »
      »
      »
      7 years ago, # ^ |
      Rev. 4   Vote: I like it +10 Vote: I do not like it

      Why do you choose Certificate Authority "starcom"?

      starcom is the worst choose CA, bcs it lost the trust. And it's not problem of my browser, it's a issue of CA because this CA abuse too many rules of creating certificates.

      And "Starcom" was bought by "WoSign" who lost the trust too.

      proof: mozilla blog, google blog

      Could you use self-signed certificate? It is not better choose but it is better than starcom IMHO

»
7 years ago, # |
Rev. 2   Vote: I like it +29 Vote: I do not like it

From the post: Note : Don't forget to register on our website to be eligible for prizes.

The page for that registration is (perhaps?..) https://felicity.iiit.ac.in/threads/codecraft/

Aaaand, the Register link leads to... https://felicity.iiit.ac.in//auth/login/

What's the matter with you people, asking to register before registration is even working? Edit: I mean, there are currently no means to associate a Codeforces account with the "registration" on your site.

Also, the site font is poorly readable in Firefox in a wide range of scales (but looks fine in Chrome).

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

    For registration for prizes, all you need to do is create an account on our website with the "nick" same as your codeforces handle. In case the nick is already taken please send us a mail @ [email protected].

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +12 Vote: I do not like it
      1. You know, you could have mentioned the "same nick" part in your post before people try to register.

      2. In some cases, mine and knst's included, what you ask for is impossible.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        1. I will update the post.
        2. We have resolved the issue of nick. Please try again.
          Sorry for the inconvenience.
        • »
          »
          »
          »
          »
          7 years ago, # ^ |
          Rev. 2   Vote: I like it +39 Vote: I do not like it

          Try again what? I've already registered under different nickname, since the site didn't allow my nickname to be used. And, I don't see any way to change it now.

          Edit: From the post: UPD: The constraint of registration for eligibility to prizes has been removed. — Thank you, I like this solution!

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Argh, was reading comments and registered there and only then I have read this UPD..

»
7 years ago, # |
Rev. 2   Vote: I like it +62 Vote: I do not like it

Error: Nick must be at least 6 characters long

really? And what I should write? knst_SPACE_DELIMITER?

»
7 years ago, # |
  Vote: I like it -22 Vote: I do not like it

Wow, this contest has my mind firing on all sorts of topics.

CodeCraft — Beer. Craft Beer.

Felicity — I am thinking about the CW show Arrow when I see this, but when I see the the font, I think about FireFly. I don't even watch firefly. Something about it makes me think about it.

Last is Threads. I am thinking about some gangster and his threads.

Well, anyway, thanks for the mind simulation and I am looking forward to the round!

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

"Note : Don't forget to register on our website to be eligible for prizes."

I registered it on the website and it redirects me back to the front page. When I re-open the register page it still says "click here to register", what did I miss?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Once you have registered, you can login and update your account information. Don't forget to set your nick same as your codeforces handle. In case it's already taken, please send us a mail @ [email protected]

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Sorry, I see no way to update account information on the Threads '17 site. Please do kindly provide a link, or instructions how to find it, if such a page exists.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it -7 Vote: I do not like it

      I still get this page after registration, is this behaviour normal, or is it because of my nickname doesn't match with my CF handle?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it +12 Vote: I do not like it

Waiting for a round with codeforces stickers as presents.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

what's the mechanism of the randomly chosen :/

»
7 years ago, # |
  Vote: I like it +103 Vote: I do not like it

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Gordian knot looks interesting, is there some sort of archive of the past problems to have a look at?

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

Wow, nice round. Never got a t-shirt ever. Good luck with me, haha.

»
7 years ago, # |
  Vote: I like it +52 Vote: I do not like it

Looks like this will be a magic round.

»
7 years ago, # |
  Vote: I like it +27 Vote: I do not like it

Will the drain be adjusted to the contest's length? If it was not planned to be, PLEASE DO SO :)! It was argued many times why not adjusted drain is a cancer and the longer duration the bigger cancer! Please, please, please.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

My First Indian Contest, Hoping For A Positive Rating Change.... bharat mata ki jai....

»
7 years ago, # |
  Vote: I like it +8 Vote: I do not like it

all we can do is hoping for the good contest

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Was the score for the problem just changed? Specifically what caused that?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

why I can't register to the contest !!

»
7 years ago, # |
  Vote: I like it -73 Vote: I do not like it

Worst contest ever!

»
7 years ago, # |
  Vote: I like it -15 Vote: I do not like it

Pretest 12 on problem B is an immovable object..

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    I guess your initial value for ans is less than 1 and your code cannot output correct answer for this test case:

    input:
    1
    1
    
    output:
    1
    
    
  • »
    »
    7 years ago, # ^ |
      Vote: I like it -13 Vote: I do not like it

    Use an unstoppable force on it. :)

»
7 years ago, # |
  Vote: I like it +11 Vote: I do not like it

for the first time I feel there is so much time left for the contest to end. :(

»
7 years ago, # |
  Vote: I like it +9 Vote: I do not like it

Great Contest ... hoping for the increment in rating !!! Best of luck Guys

»
7 years ago, # |
  Vote: I like it -103 Vote: I do not like it

testcase 5 1 1 1 1 1 answer is 1 this case sucks

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

after the contest gets over , help me solving problem C.I have done the mathematics behind it but dont know what algo to use and what data structure to implement my maths

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Two pokemon of types i and j can be permuted if the number of occurences of pokemon type — i and j are equal in all the gyms.

    Try to prove it.

    My pretests passed though.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +2 Vote: I do not like it

      as is said i got the maths.You are correct.But i dont know what data structure to use and how to implement it.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I used hashing technique, but I'm not sure this is a wise way to solve this problem.

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

that moment ,when you help people but you can't help your self ... -hack A then you hacked !-

»
7 years ago, # |
  Vote: I like it +18 Vote: I do not like it

Did anyone solved problem C with hashes?

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Can someone explain how to do C?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For each pokemon type x, maintain a multiset of indexes of gyms containting x. Now form clusters of similar multisets. A cluster of size n can contribute n! ways to the answer.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Could you explain why the contribution is n! ?

      • »
        »
        »
        »
        7 years ago, # ^ |
        Rev. 2   Vote: I like it +1 Vote: I do not like it

        It's the number of permutation. You can permute all the N pokemons (from that cluster) between them and the number of each pokemon type from that cluster is the same.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I did something very similar to that. Can I ask how you calculated n! mod m? And how you modded your answer variable in general?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        m can be maximum 1e6 so just precalculate fact[i]%MOD (1<=i<=1e6)

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      but gyms and their count in that gym both must be same right??How do you deal with that

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I used map< vector , int> cnt for that. But I don't know about its time complexity then solved it using hashing. Not sure if it will pass systest or not.

  • »
    »
    7 years ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it
    code
    • »
      »
      »
      7 years ago, # ^ |
      Rev. 2   Vote: I like it +15 Vote: I do not like it

      This code is not needed once we have access to this: 23747486
      No maps, no tries — the code is very simple.

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

        I wish I could think of simple solutions like that.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it +6 Vote: I do not like it

          I am even more impressed by the fact that he came up with a solution in 4 minutes =)

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

        Can you explain what is being done over here in this code !

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it +2 Vote: I do not like it

          Each vector a[i] has indices of pokemon gyms where this pokemon initially was. On sorting, the vectors get sorted among themselves.

          Now, if a[i]=a[i-1]:

          These two pokemons were present in the exact same gyms with same frequency in each of them. Now, we know that any permutation of such sets is a valid one, thus, we increment 't' and multiply to the ans.

          eg- if input was
          3 5
          4 1 2 1 3
          6 2 3 3 2 4 5
          4 2 3 4 5

          Then, a[] will look like this
          1 : 1
          2 : 1,2,2,3
          3 : 1,2,2,3
          4 : 2,3
          5 : 2,3
          ans = (1) * (1*2) * (1*2)

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I cannot understand what you did after storing the indices of gym for each pokemon?

            • »
              »
              »
              »
              »
              »
              »
              7 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              It's not what I did, it's what Tourist did.

              He sorted the array of vectors. The sorting resulted in lexicographical sorting among the vectors. In my comment above, a[] looks like that due to lexicographical order. Each vector in a[] represents a pokemon( we don't care which pokemon it originally was, we just care about the vector it represents ). So, if two pokemons have same vector, this means, they can be evolved into each other. Similarly, if k pokemons have same vector, they can be evolved into each other( hence, answer for this group of pokemons is k! ). If two vectors are not same, then the corresponding pokemon can't be evolved into each other.

              • »
                »
                »
                »
                »
                »
                »
                »
                7 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Let me add a few minor points.

                Each vector<int> can be thought of as a type descriptor (not pokemon descriptor) and we compare those type descriptors with each other (not pokemons).

                Each type descriptor is composed out of pokemons (well, their's type).

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Overall a quite good contest but it feels sad when the ranking are decided by number of successful hacks instead of speed of solving problems.

»
7 years ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

anta did 18 successful hacking attempt while tourist 10 (both are good)..... after that tourist solved problem 'G' and placed first.

»
7 years ago, # |
Rev. 4   Vote: I like it -44 Vote: I do not like it

WHY,WHY in problem D is needed to set limits up to 75?Why not 50??It is so strict.

Problem E is a very good problem to practice your oeis skills....

Please,pratice more before making a round,and even if you try don't put stupid problems with stupid observation and stupid limits.

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

    How exactly did you use oeis?

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

      Treat primes independently,you can easily get that you can deal only with px and only x is important,generate answers for n = 2, 4, 8, 16 and do oeis for every n with r = 0, 1, 2, 3, 4.

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it +10 Vote: I do not like it

    I did OEIS for two vectors with fixed N, saw that they are quadratic and cubic polys, interpolated and factored polys for many different N and saw a simple pattern:

    A factor pe of N contributes to the product:

    • r if e = 1,
    • (r - 1)r(r + 1)(r + 2)...(r - 1 + e - 2) * (r + 2 * (e - 1)) / factorial(e) otherwise.

    fix: r here is r from query increased by 2.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How to solve it, was it based on mobius function? Fr(n) was multiplicative, probably. Also I tried to use if p is prime, f0(p^a) = 2, f1(p^a) = 2a + 1, f2(p^a) = (a + 1)^2, f3(p^a) = (a+1)(a+2)(2a+3)/6, and then it got lost.

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

      f_n(p^a) = f_{n-1}(1) + f_{n-1}(p) + f_{n-1}(p^2) + ... + f_{n-1}(p^a) = f_n(p^{a-1}) + f_{n-1}(p^a). I just used dynamic programming to precalculate all values.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    No need for OEIS in E. It is just plain dynamic programing for O(MaxR * MaxPrimePower).

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

for problem B, with this input

3

3 3 3

the output is 3 ?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yep!

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes.

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

    I have copied one solution and on my computer the answer is 1, obviosly i hacked him, but got Unsuccessful hacked attempt, now I saw that on codeforces for same solution the answer is 1, why so ?

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Did you copy or retype? (you can't copy during contest)

      I think you have made mistake in typing his\her solution.

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

        no, i didn't, i even made copy-paste(after contest) and the ansewer is 3.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          but... it should be 3, right?

»
7 years ago, # |
  Vote: I like it +18 Vote: I do not like it

Can anybody explain how to solve D?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +29 Vote: I do not like it

    I used the following dynamic programming:

    1. A state is a mask of already seen numbers (the largest number is always at most 20) and the position in the string.

    2. A transition is just going from one position to some other to the right from it and adding the corresponding number to the mask.

    This solution is fast enough if implemented properly.

    • »
      »
      »
      7 years ago, # ^ |
      Rev. 3   Vote: I like it +21 Vote: I do not like it

      The key observation is that out of the n*(n+1)/2 substrings, there can be at most n*5 substrings that correspond to numbers between 1 and 20, so you can cut a factor of n from the runtime.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You forgot about leading zeroes.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it +13 Vote: I do not like it

          There are still at most 5 transitions. 0 is not allowed, so leading zeros only move the start of the valid range to the right. They can't increase its length.

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Ahh, if we fix start of interval there are at most 5 ends, I missed that, nice.

»
7 years ago, # |
  Vote: I like it +92 Vote: I do not like it

Hacking is hard when you are colorblind...

»
7 years ago, # |
  Vote: I like it +8 Vote: I do not like it

What was the approach for problem E?Did it involve mobius inversions?

  • »
    »
    7 years ago, # ^ |
    Rev. 4   Vote: I like it +52 Vote: I do not like it

    I noticed that the function is multiplicative. So I tried to solve for a prime power pe. Notice that

    .

    If you let then the above translates into

    .

    This recurrence is the same as counting monotone lattice paths from (0, 0) to (e, r). Combining with base cases, you can find the solution

    .
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem B hacking case 3 1 1 1 output: 1

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

To solve Problem D, I was using the fact the maximum number could be 20. Hence my DP array should be :DP[1<<20][75][75] (which is MLE) where the state of DP is(mask,idx,currentCuts). How can i optimize my memory ?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    you dont need to keep track of currentCuts as you just need the total sum and not the actual value for each K

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks.It was to silly of me to put currentCuts in DP state.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Damn... But I have managed to squeeze into time and memory limits with keeping track of currentCuts :)

»
7 years ago, # |
  Vote: I like it +67 Vote: I do not like it

the friend residing in that city dies, so he is unhappy as well.

»
7 years ago, # |
  Vote: I like it -26 Vote: I do not like it

tourist again :( !

»
7 years ago, # |
  Vote: I like it +260 Vote: I do not like it

Hacking of C was so exciting.

For example, Errichto used XOR for hashing. So I wrote Gaussian elimination.

Errichto and wokop22's best strategy was submit a code just before the contest ends. So I don't have enough time to hack it.

And the result of this is Errichto's win. Congrats!

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +28 Vote: I do not like it

    That sounds kind of contest-breaking, they shouldn't be about this.

    I'll remember it as a viable strategy regardless. :D

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +37 Vote: I do not like it

    I'm glad you had fun. And during the round I didn't realize that my solution is hackable because of xoring — so I learnt something today.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi. I am noticing many people this round who are colored red and rated Grandmaster. However, when I click on their profile, their rating is much less than 2400. Does anyone know why this is? Is it a bug with the website?

»
7 years ago, # |
  Vote: I like it +4 Vote: I do not like it

»
7 years ago, # |
Rev. 2   Vote: I like it +34 Vote: I do not like it

Thank you for good contest.

Special thanks to C (which can be solved without hashes :)) and E authors.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How did you solve C without hashing?

    I used sums of rand()s, but it's basically the same thing as hashing.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +25 Vote: I do not like it

      One can show that storing the vector of pairs (gym, count) for all Pokemon is fast enough in the worst case.

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

        What is the worst case complexity for such sorting and how can we prove it?

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          It depends on your choice of sorting algorithm. I don't know exactly what std::sort does, but it got AC.

    • »
      »
      »
      7 years ago, # ^ |
      Rev. 2   Vote: I like it +10 Vote: I do not like it

      Well, actually problem is about splitting pokemon types into clusters, where in one cluster number of pokemons of each type is same in each school.

      Let's build this clusterization sequentially, adding school by school to it.

      (You may ask here what "clusterization" is. Clusterization here is array c[i], which contains identifier of cluster for each type, one class will have same numbers, and different from all others).

      So how to process a school?

      Group pokemons together by type and count them (in each group, you will have pairs "type, count" after it). Then group pokemon types by number of pokemons in them. (This step can be done in ), don't touch pokemon types with zero pokemon count, it would be too slow).

      Now we have "old clusterization" and new classes to split it.

      Iterate over groups of types with same number of pokemons. Split each group by current clusterization. Take note, that each subgroup will have a common type.

      So we will simply assign to c[i] some common unique value for all types in this subgroup. (How to get this unique value? Just maintain the maximum of current values in c[i]).

      Remark. We just didn't payed attention to group with 0 pokemon types, but if you look carefully you will see, that it's c[i] don't need to be updated.

      Remark. All steps above are done in time.

      Remark. If you have troubles understanding text above, you may want to draw some pictures on paper -- draw a circle and split it's area into pieces. Consider this to be old clusterization. Add some more circles into previous one, it should have some non-trivial intersections with previous classes. Consider this to be groups of pokemon types with same number from new school, currently processed.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        How do you store such clusters? I was trying to avoid sets/maps but in the end had to store clusters as sets, to allow quick removal (when intersecting one cluster with another). 23753670

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it +13 Vote: I do not like it

          As i said, I only store c[i] array. No need to store more.

          My approach is intersection each class of pokemons within school with old clusterization. This way i get brand new clusters, which can be be enumerated and assigned to array back.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          http://codeforces.com/contest/757/submission/23755165

          I had a similar approach to @cdkrot's comment.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

any ideas how to solve B? I found it quite hard to do it in O(N) or O(Nlogn)

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

    If gcd(a, b) != 1, a and b have at least 1 prime in common. For each prime that divides each number do freq[prime]++ and take the greatest of frequencies.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I tried that with once with clasical prime factorization(23760980) first and then with sieve(23762396) and both time TLE on 11th pretest :(

      • »
        »
        »
        »
        7 years ago, # ^ |
        Rev. 10   Vote: I like it +1 Vote: I do not like it

        what you are doing wrong is you are generating prime numbers uptil (100000).the prime number count uptil that is 9950.So your run time will be 10^4*10^5=10^9 approx. which will result in a tle on case 11 .I was having the sae problem.Then i did something smart .I calculated primes only uptil sqrt(10^5).And while traversing array i kept on dividing the arrays with these primes.At the end what was left in the array were themselves primes which u can count in an O(n) operation.So the complexity was brought down from 10^5*10^4 to 10^5*sqrt(10^5)=10^5*10^2=10^7 approx which is within time bounds

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Instead of checking until X every time, save a vector for each number with the primes that divide it. Remember that the sieve is O(nloglogn) so the memory complexity of having the prime factorization is O(nloglogn) as well.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    do something like sieve function.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Do the prime factorization of each element of array. Elements which have atleast one prime factor in common will have gcd>1,thus they can be included. Maintain an array x in which x[i] is the count of array elements which have x[i] as one of its prime factor. Answer will be the maximum x[i].

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it +9 Vote: I do not like it
    for(int i = 2; i <= mx; i++){
        now = 0;
        for(int j = i; j <= mx; j += i)
            now += cnt[j];
       ans = max(ans, now);
    }
    

    Works O(mx * log(mx))

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        N / 1 + N / 2 + N / 3 + ... N / N = N * (1 / 1 + 1 / 2 + 1 / 3 + ... + 1 / N) = N * log(N)

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Not the time complexity but the explanation of solution.

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            gcd(x,y) = g implies x,y >= g and g | x,y .

            The outer loop just fixes the gcd and the inner loop sums up the counts of all multiples of that gcd .

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

    Am I the only who had been surprised when seeing Zlobober is asking this question and then noticed that it's zlobber not Zlobober? :/

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +29 Vote: I do not like it

      Yay, I was also kinda surprised. Just wait until magic ends, and it will return to normal.

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

    While this submission did not pass system testing (WA on test 82)...it was such a monumentally hilarious idea that I think it should be public..

    23759222

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

wish no fst!

»
7 years ago, # |
  Vote: I like it +154 Vote: I do not like it

Thank you!

»
7 years ago, # |
  Vote: I like it +15 Vote: I do not like it

Really unusual problem set, not very hard, but no easy problem..

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

I tried to hack this solution for problem B. It uses strlen() for computing length in each iteration. So, I thought it would O(n*n) complexity. I gave input string of "zzz..." 10^5 times but it passed easily. Any help on why did it happened ?

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

    A compiler can optimize it if the string doesn't change (it's not guaranteed, though).

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Suprisingly, I successfully hacked another such solution(here) with the same case.

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

        Its because he is using global variables. Hence (almost) no optimizations.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        One solution uses GNU C11, the other uses GNU C++. Does this make the difference?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Modern compilers are smart, so perhaps they take this opportunity to optimize and place the calculation before the loop.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    AFAIK, compiler is not optimizing semantics of strlen and other funcs.

    But strlen's implementation is bloody fast -- it can be written using SSE for example.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice set of problems! Problem statements were well articulated.

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

Used hash in problem C, failed systest. #notcool#feelsbadman

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    your hash type is 32 bit, it means your hash value has 2^32 possible value, according to:

    https://en.wikipedia.org/wiki/Birthday_attack and https://en.wikipedia.org/wiki/Birthday_problem

    It says that if we have 10^6 object (pokemons) and hash value is 32 bit (2^32) the probability of at least 1 collision is over 99% no matter how good your hash function, but if we use 64 bit the probability of collision is far less than 1%

    I'm curious if there are accepted user with 32-bit hash? I want to confirm wiki theorem :p

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Actually my hash type is 64 bits, I used unsigned long long. but maybe my base 98317 is too weak.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I did it using two simultaneous hashes with different bases and got AC.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Passed using hashing here.

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

    To prevent systest fail, I used three hash functions :) Here is my source!

»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it

This time lots of hacks & system failure !!!! :P

»
7 years ago, # |
Rev. 2   Vote: I like it +103 Vote: I do not like it

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    Can someone explain me this comment? Does it suggest that tourist invents better problems? I don't get it.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +43 Vote: I do not like it

      It refers to the CodeCraft tagline, "So you think you can code?"

»
7 years ago, # |
  Vote: I like it +48 Vote: I do not like it

Hmm...

»
7 years ago, # |
  Vote: I like it +27 Vote: I do not like it

mtomic the TOPPEST of ANIMALS!!! Take a bow son, take a bow!!!

»
7 years ago, # |
Rev. 2   Vote: I like it +65 Vote: I do not like it

And there were 104 tests...

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    congrats. you just got an AC.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks, by declaring int nr[80][(1<<20)+100]; I got AC. I overextended a bit with the memory :).

»
7 years ago, # |
  Vote: I like it +44 Vote: I do not like it

Got WA on C because of low RAND_MAX. Gotta love Windows.

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

    Me too.

    Something like rand() * rand() + rand() would probably work.

    EDIT: Confirmed, got AC with this change.

    • »
      »
      »
      7 years ago, # ^ |
      Rev. 2   Vote: I like it +8 Vote: I do not like it

      rand() * MAX_RAND + rand() is better — all values can be achieved, assuming that consecutive calls of function are independent.

      Edit. As mareksom pointed out (thanks!), my way isn't perfect either. It isn't deterministic which of two rand's will be computed first and thus theoretically two runs of the same program can give different behaviour. So, it's better to do int tmp = rand(); int big = tmp * MAX_RAND + rand().

      • »
        »
        »
        »
        7 years ago, # ^ |
        Rev. 2   Vote: I like it +30 Vote: I do not like it

        To be completely precise, assuming that rand() gives a uniformly distributed value on [0, RAND_MAX], and that two consecutive calls of rand() are independent random variables (that is not true, of course, but imagine that), to get a wider uniform distribution, you should use int tmp = rand(); int big = tmp * (RAND_MAX + 1) + rand(), since RAND_MAX (that is equal to, for example, 32767 under Windows) is an inclusive bound.

»
7 years ago, # |
  Vote: I like it +76 Vote: I do not like it

Am I the only one who copied wrong spelling in hurry just because of this line in explanations

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    No. I've found at least 6 solutions doing this, in my room :|

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +2 Vote: I do not like it

      Yeah, you literally killed your room :/ I guess it should be a record or something. And by record I mean placing 288th only solving 2 problems and 19 hacks :D

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

        I once stood 49 based on just hacking and solving just 2 problems. (my third one failed system test). Link to round and Scoreboard

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          That was quite awesome :D On the other hand, today was a mixed contest of Div1 and Div2. So, 288th is kinda equivalent :D

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

    I did it too!

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How many tests were provided for G?

Because it is really bad feeling.

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it -8 Vote: I do not like it

here is a bug in system testing with my code 23767420 in problem 757E - Bash Plays with Functions my submission got WA on test case 57 while when i compiled on codechef ide with the same code it gave me the correct answer....i also faced the same problem of compilation before some time but it was on practice mode but this time it will affect my rating please resolve it if possible

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Did you run the code with test case 57 as input (on the codechef IDE)?

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yes i run my code with by taking 20 initial case of test case 57 and on codechef IDE it gave me the correct answer for those 20 case while on codeforces it gave me wrong answer on 1st case in 57 test case

»
7 years ago, # |
  Vote: I like it +54 Vote: I do not like it

Test cases for D are so weak! We don't have to use 20 to pass all cases.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I thought of getting TLE on C using just vectors and sortings without hashing. But it gets AC fast enough.

»
7 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Awesome contest :)

»
7 years ago, # |
  Vote: I like it +39 Vote: I do not like it

Yay finally became orangy on my birthday :)

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Yay finally I failed another contest, even though I scored F I won't get 2200 before my round :<

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Why can the maximum number be 20 in problem D? I think it should be 16 only. Because minimum number of bits required to represent all numbers from 1 to 16 is 70. Minimum number of bits required to represent all numbers from 1 to 17 is 76. And the string length is only  ≤ 75. Am I right?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You are wrong in your calculations, 74 is enough for 20.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Apparently not. Here is the string of length 74 which is a concatenation of binary representations of 1 to 20.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, I miscalculated. My bad!

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    re-calculate the same again, its 74 bits required for 1-20.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What about problem F? I'm really curious.

»
7 years ago, # |
  Vote: I like it +23 Vote: I do not like it

Congrats rajat1603 for becoming red

»
7 years ago, # |
  Vote: I like it +8 Vote: I do not like it

magic is so buggy with rating changes!

»
7 years ago, # |
  Vote: I like it +39 Vote: I do not like it

Someone just copied tourist's code for problem G and got AC but using C++14 instead of C++11 heh

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

    he also changed one cout to printf.

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it +424 Vote: I do not like it

    Yeah, and the funny thing is that neither changing cout to printf nor submitting under C++14 works for me :)

    Resubmitting many times might probably help.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +13 Vote: I do not like it

      or add some comments :)

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +94 Vote: I do not like it

      Another way to make it pass is to politely ask compiler to produce faster code using O3 (23772403).

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I thought places like CF would have -O3 by default. Surprised to learn that isn't the case.

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

      I heard from the problem setter that the expected solution was O(N * log(N)) and that only highly optimized O(N * log2(N)) should have passed.

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it +13 Vote: I do not like it

        During the contest I tried to submit the solution that does not use the fact we swap only the adjacent elements, but it used Cartesian trees and it worked about 6-7 seconds on maxtests. After the contest I managed to replace all Cartesian trees simply with vectors and binary searches, it still works in and fits in 2.1 sec: http://codeforces.com/contest/757/submission/23772311 Though, it now relies on that only the adjacent elements are swapped.

        This solution may even be optimized to if we use fractional cascading technique, but it is much harder to implement and I'm not sure if it would significantly reduce the running time.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
          Rev. 2   Vote: I like it +10 Vote: I do not like it

          How could fractional cascading work? I think my approach is the same and I have thought about fractional cascading, but it seems like there may be too many children for each node so we can't store next-level pointer for every branch.

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Seems you are right, I didn't notice that in contrary to segment tree in centroid decomposition we have many children. Looks like it makes impossible to find the right position in O(1) when moving from level to its child.

            Ok, I don't know how to solve it in :)

          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
              Vote: I like it +10 Vote: I do not like it

            I've just realized that if we ternarize the tree by adding d - 3 edges of zero length to each vertex of degree d > 3 (as described in the editorial), my approach works fine, since the centroid decomposition tree becomes no more than ternary and we need to store no more than three mappings from current level into children levels.

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

              Right. It's funny that binary tree actually works better in a centroid decomposition solution in this case. :)

            • »
              »
              »
              »
              »
              »
              »
              7 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Well, I met a new problem when I tried to implement it: is there a simple way to maintain fractional cascading after a swap? Since swap is a relatively simple operation I guess there might be one, but I can't find it.

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it +10 Vote: I do not like it

    The TL of Problem G seems to be too tight!

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

      Maybe the author has a better solution. If not I would be sad about these constant factors...

      Anyway, I should foresee this before implemented it, but "solving the last problem" is really a beautiful fantasy :(

      Edit: All right, I'm stupid. It seems like I used some unnecessary data structures...

»
7 years ago, # |
  Vote: I like it +84 Vote: I do not like it

When will the list of Tshirt winners be announced? Anytime soon?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

3 101 Why answer is 5 in Problem D?

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

How is F solved?

»
7 years ago, # |
  Vote: I like it +22 Vote: I do not like it

When will be editorial?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

http://codeforces.com/contest/757/submission/23774954

Can anyone please help take a look why did this submission failed on test case 9? I spent some time on comparing it with some AC submissions and found out that the code went wrong starting on str[52], but I have no idea why did it cause the problem.

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

    The range of your dp should be 2^20 instead of 2^19.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Ah... That was a really dumb mistake. Thanks for the help.

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

i figured a N*sqrt(N) solution for problem B ,by dividing each number of array with i,(n/i) and then taking the max of count of numbers each divides , but it fails on test #54 — link ,, any help?

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There might exist an a[j] > sqrt(n) where a[i] = n/a[j] does not exist.

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

any editorial?

»
7 years ago, # |
  Vote: I like it +6 Vote: I do not like it

@tanujkhatter When will the editorial be released?

»
7 years ago, # |
  Vote: I like it +24 Vote: I do not like it

Baba When will the editorial be released?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Could anybody please explain how to solve D,i've tried to comprehend the solituon of tourist but didn't get it,and i can't wait until the editorial is published:)

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

    I've used simple recursive search with memoizing and cutting search when there is not enough space to finish the sequence. Got AC with PyPy, 2.5s / 4s: 23765504

»
7 years ago, # |
  Vote: I like it +1 Vote: I do not like it

In problem C, why does 1. get TLE -
1. (Using unordered_map) http://codeforces.com/contest/757/submission/23759809
2. (Using map) http://codeforces.com/contest/757/submission/23779874
Isn't unordered_map supposed to be faster?

»
7 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Thank you for this competition. Problems were very interesting. I like problem B.

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

where is the offical solutions?

»
7 years ago, # |
  Vote: I like it +143 Vote: I do not like it

What about Tshirts?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Baba (previous revision, new revision, compare).

»
7 years ago, # |
  Vote: I like it +36 Vote: I do not like it

I wonder when the T-shirt winners will come out…

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey !! I was trying to attempt problem C and I think my logic is correct but I am getting a WA on test 31 and I am not able to figure out bug in my code http://codeforces.com/contest/757/submission/23790926. I think problem is related to string which is used in map but I am not able to understand, can anyone help on it ??

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

    mp[x] += i+'0';

    i can be big (> 256), so your solution incorrect.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I am not able to understand properly can you elaborate on it a little. Thanks

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

        You seem to try to add a character i + '0' at the end of the hash of x mp[x], but in the value of a character must be under 128 (256 if unsigned char) while i can be as big as n. That is where and why it went wrong.

»
7 years ago, # |
  Vote: I like it +110 Vote: I do not like it

It's time to announce how the random t-shirt winners are selected. We have a generator based on testlib.h (see code below) which will print the winning places. The seed will be the score of the first place in the tomorrow 8VC Venture Cup 2017 - Elimination Round.

Generator
  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What if there are two people with the same ranks?

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

      "The seed will be the score of the first place in the tomorrow"

      So if there are two people with the same ranks, score will be the same.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +12 Vote: I do not like it

      Challenge succeeded!

      Within this procedure we will assume that ties are broken by the time of last AC.

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it +124 Vote: I do not like it

    There is a tiny chance of the following scenario:

    1. someone (person A) had rank 26-500 in Codecraft contest
    2. person A leads in 8VC contest by a big margin,
    3. person A checks if his current score gives him T-shirt for Codecraft

    3Yes: person A gets T-shirt.

    3No: person A does stupid hack and gets -50 pts. goto 3.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +62 Vote: I do not like it

    61 84 129 162 170 190 227 239 247 251 272 292 312 344 352 355 363 365 386 415 420 433 442 443 466

»
7 years ago, # |
  Vote: I like it -10 Vote: I do not like it

In problem C , getting WA on test 74 !! Stored all gym no. for each pokemon type in arralists and sorted ! Solution similar to that of tourist's ! http://codeforces.com/contest/757/submission/23807513 http://codeforces.com/contest/757/submission/23747486

»
7 years ago, # |
  Vote: I like it +59 Vote: I do not like it

The t-shirt winners are:

Place Handle
1 tourist
2 W4yneb0t
3 anta
4 Um_nik
5 ershov.stanislav
6 LHiC
7 jcvb
8 GlebsHP
9 jiry_2
10 Egor
11 pavel.savchenkov
12 sd0061
13 savinov
14 zeliboba
15 Shik
16 pacu
17 SirShokoladina
18 mtomic
19 jqdai0815
20 Endagorion
21 Zlobober
22 ToTLeS
23 Merkurev
24 enot110
25 yosupo
61 skywalkert
84 Hujiwara
129 KArs
162 dragoon
170 eudanip
190 tt.anhquynh
227 Kuzey
239 tloinuy
247 darknsux
251 Tinsane
272 sp_502
292 mingaleg
312 JATC
344 I_See_You
352 tundra
355 polingy
363 farmerboy
365 VladRochian
386 DaniilF
415 Phoenix.
420 dreamplay
433 Shivram
442 hld67890
443 ONCEcoder
466 _Mr.T_

Congratulations!

»
7 years ago, # |
Rev. 7   Vote: I like it +10 Vote: I do not like it

KAN Is there any restriction on some Countries ? where T-shirts can not be sent :/ .