tanujkhattar's blog

By tanujkhattar, history, 5 months 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. jcccccccccccccccccccccsb
  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  

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

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

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

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

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

?

»
5 months 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.

»
5 months 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

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

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

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

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

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it +7 Vote: I do not like it
      • »
        »
        »
        »
        5 months 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

        • »
          »
          »
          »
          »
          5 months 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)

          • »
            »
            »
            »
            »
            »
            5 months 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.

            • »
              »
              »
              »
              »
              »
              »
              5 months 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

        • »
          »
          »
          »
          »
          5 months 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...

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

            you're totally right sa1378. take my downvote

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

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

          • »
            »
            »
            »
            »
            »
            5 months 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!!!

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

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

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

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

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 months 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!!! +_+

»
5 months 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

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

7 Problems, 3 Hours... Eager to take part in the contest

»
5 months ago, # |
  Vote: I like it -26 Vote: I do not like it

Looking forward to the longer contest :)

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

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

»
5 months ago, # |
  Vote: I like it -39 Vote: I do not like it

It is rated!

»
5 months 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?

»
5 months 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?

:-)

»
5 months ago, # |
  Vote: I like it -32 Vote: I do not like it

** ** *****.

»
5 months 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?

  • »
    »
    5 months 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.

    • »
      »
      »
      5 months 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

»
5 months 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).

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

    not really!

  • »
    »
    5 months 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 @ threads@felicity.iiit.ac.in.

    • »
      »
      »
      5 months 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.

      • »
        »
        »
        »
        5 months 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.
        • »
          »
          »
          »
          »
          5 months 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!

          • »
            »
            »
            »
            »
            »
            5 months 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..

»
5 months 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?

»
5 months 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!

»
5 months 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?

  • »
    »
    5 months 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 @ threads@felicity.iiit.ac.in

    • »
      »
      »
      5 months 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.

    • »
      »
      »
      5 months 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?

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

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

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

Waiting for a round with codeforces stickers as presents.

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

what's the mechanism of the randomly chosen :/

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

    int x=1+(rand()%500) ;

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

      I think you mean int x = 26 + (rand() % 474)

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

        no it should be int x= 26+rand()%475 .

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

          Maybe this will be more better :
          ...
          ____int x = 1 + (rand() % 500);
          ____while (x <= 25 || was[x] == true)
          ________x = 1 + (rand() % 500);
          ____was[x] = true;
          ...

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

        aka.Sohieb you are wrong. You forgot to include 500 in the range.

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

That's great , if -by chance- i get a T-shirt i will offer to replace it with +200 rate :"D

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

»
5 months 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?

»
5 months 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.

»
5 months ago, # |
  Vote: I like it -14 Vote: I do not like it

Looks as if the contest already got some negative feedback(s). The problems regarding the registration and all... Hope the problem set is good.

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

Looks like this will be a magic round.

»
4 months 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.

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

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

»
4 months 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....

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

all we can do is hoping for the good contest

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

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

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

why I can't register to the contest !!

»
4 months ago, # |
  Vote: I like it -73 Vote: I do not like it

Worst contest ever!

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

Pretest 12 on problem B is an immovable object..

  • »
    »
    4 months 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
    
    
  • »
    »
    4 months ago, # ^ |
      Vote: I like it -13 Vote: I do not like it

    Use an unstoppable force on it. :)

»
4 months 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. :(

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

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

»
4 months 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

»
4 months 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

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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.

      • »
        »
        »
        »
        4 months 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.

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

          A person gave me the idea of trie .Will implement using it.

»
4 months 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 !-

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

Did anyone solved problem C with hashes?

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

Can someone explain how to do C?

  • »
    »
    4 months 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.

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

      Could you explain why the contribution is n! ?

      • »
        »
        »
        »
        4 months 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.

    • »
      »
      »
      4 months 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?

      • »
        »
        »
        »
        4 months 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)

    • »
      »
      »
      4 months 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

      • »
        »
        »
        »
        4 months 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.

  • »
    »
    4 months ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it
    code
    • »
      »
      »
      4 months 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.

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

        I wish I could think of simple solutions like that.

        • »
          »
          »
          »
          »
          4 months 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 =)

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

            I didn't know we can sort an array of vectors like he did.

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

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

        • »
          »
          »
          »
          »
          4 months 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)

          • »
            »
            »
            »
            »
            »
            4 months 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?

            • »
              »
              »
              »
              »
              »
              »
              4 months 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.

              • »
                »
                »
                »
                »
                »
                »
                »
                4 months 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).

»
4 months 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.

»
4 months 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.

»
4 months 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.

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

    How exactly did you use oeis?

    • »
      »
      »
      4 months 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.

  • »
    »
    4 months 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.

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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.

  • »
    »
    4 months 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).

»
4 months 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 ?

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

    yep!

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

    Yes.

  • »
    »
    4 months 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 ?

    • »
      »
      »
      4 months 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.

      • »
        »
        »
        »
        4 months 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.

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

          but... it should be 3, right?

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

            yes, i was wrong...and think i made a mistake when retyping:/

»
4 months ago, # |
  Vote: I like it -22 Vote: I do not like it

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

Can anybody explain how to solve D?

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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.

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

        You forgot about leading zeroes.

        • »
          »
          »
          »
          »
          4 months 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.

          • »
            »
            »
            »
            »
            »
            4 months 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.

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

Hacking is hard when you are colorblind...

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

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

  • »
    »
    4 months ago, # ^ |
    Rev. 3   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

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

Problem B hacking case 3 1 1 1 output: 1

»
4 months 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 ?

  • »
    »
    4 months 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

    • »
      »
      »
      4 months 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.

    • »
      »
      »
      4 months 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 :)

»
4 months 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.

»
4 months ago, # |
  Vote: I like it -26 Vote: I do not like it

tourist again :( !

»
4 months 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!

  • »
    »
    4 months 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

  • »
    »
    4 months 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.

»
4 months 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?

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

»
4 months 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.

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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.

      • »
        »
        »
        »
        4 months 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?

        • »
          »
          »
          »
          »
          4 months 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.

    • »
      »
      »
      4 months 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.

      • »
        »
        »
        »
        4 months 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

        • »
          »
          »
          »
          »
          4 months 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.

        • »
          »
          »
          »
          »
          4 months 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.

»
4 months 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)

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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 :(

      • »
        »
        »
        »
        4 months 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

      • »
        »
        »
        »
        4 months 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.

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

    do something like sieve function.

  • »
    »
    4 months 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].

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

    This is my idea.Although i dont know whether it will pass the system test.It's O(n(sqrtn)loglogn). First i ran seive algo to generate prime numbers till sqrt (n).That took me sqrtn(loglogsqrtn) time.after generating the prime numbers i divided each array element by all these prime numbers till sqrtn that i generated.In doing so i also mantained a count which will be the answer variable.With each prime a new answer.i also kept on dividing array by these primes so that after i had used all the primes what was left were only further primes in the array.I counted each primes occurence after sqrtn in array and then reupdated the answer if possible.Its O(n*sqrtn*loglogn)

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

    Make array D[100000], where d[i]="lowest divisor of i(not 1 of course)", then for every integer of the input (let it be x) save the values of D[x] in other array. Then determine the maximum number of equal elements in this array and this will be the answer. But have not passed system tests yet.[FAILED]

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

      Huh you're sure?But just because 2 elements don't have same lowest divisors it doesn't mean they are coprimes.Try 3,6,33 your algorithm output is 1 (?) but answer is 3.

  • »
    »
    4 months 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))

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

      How?

      • »
        »
        »
        »
        4 months 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)

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

          Not the time complexity but the explanation of solution.

          • »
            »
            »
            »
            »
            »
            4 months 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 .

  • »
    »
    4 months 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? :/

    • »
      »
      »
      4 months 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.

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

        It seems like my handle is giving me some privileges in comments.

  • »
    »
    4 months 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

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

wish no fst!

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

Thank you!

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

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

»
4 months 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 ?

  • »
    »
    4 months 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).

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

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

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

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

      • »
        »
        »
        »
        4 months 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?

  • »
    »
    4 months 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.

  • »
    »
    4 months 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.

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

Nice set of problems! Problem statements were well articulated.

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

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

  • »
    »
    4 months 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

    • »
      »
      »
      4 months 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.

  • »
    »
    4 months 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.

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

    Passed using hashing here.

  • »
    »
    4 months 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!

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

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

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

  • »
    »
    4 months 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.

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

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

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

Hmm...

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

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

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

And there were 104 tests...

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

    congrats. you just got an AC.

    • »
      »
      »
      4 months 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 :).

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

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

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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().

      • »
        »
        »
        »
        4 months 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.

»
4 months 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

  • »
    »
    4 months 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 :|

    • »
      »
      »
      4 months 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

      • »
        »
        »
        »
        4 months 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

        • »
          »
          »
          »
          »
          4 months 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

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

    I did it too!

»
4 months 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.

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

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

»
4 months 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 - Баш играет с функциями 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

  • »
    »
    4 months 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)?

    • »
      »
      »
      4 months 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

»
4 months 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.

»
4 months 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.

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

Awesome contest :)

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

Yay finally became orangy on my birthday :)

  • »
    »
    4 months 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 :<

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

I think I have a different approach for Problem C. Have a look at my code

»
4 months 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?

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

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

  • »
    »
    4 months 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.

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

    Yes, I miscalculated. My bad!

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

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

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

What about problem F? I'm really curious.

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

Congrats rajat1603 for becoming red

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

magic is so buggy with rating changes!

»
4 months 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

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

    he also changed one cout to printf.

  • »
    »
    4 months 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.

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

      or add some comments :)

    • »
      »
      »
      4 months 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).

      • »
        »
        »
        »
        4 months 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.

    • »
      »
      »
      4 months 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.

      • »
        »
        »
        »
        4 months 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.

        • »
          »
          »
          »
          »
          4 months 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.

          • »
            »
            »
            »
            »
            »
            4 months 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 :)

          • »
            »
            »
            »
            »
            »
            4 months 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.

            • »
              »
              »
              »
              »
              »
              »
              4 months 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. :)

            • »
              »
              »
              »
              »
              »
              »
              4 months 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.

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

    The TL of Problem G seems to be too tight!

    • »
      »
      »
      4 months 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...

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

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

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

Could not even understand problem C?

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

3 101 Why answer is 5 in Problem D?

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

How is F solved?

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

When will be editorial?

»
4 months 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.

  • »
    »
    4 months 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.

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

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

»
4 months 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?

  • »
    »
    4 months 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.

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

any editorial?

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

@tanujkhatter When will the editorial be released?

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

tanujkhattar When will the editorial be released?

»
4 months 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:)

  • »
    »
    4 months 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

»
4 months 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?

»
4 months 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.

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

where is the offical solutions?

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

What about Tshirts?

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

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

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

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

»
4 months 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 ??

  • »
    »
    4 months 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.

    • »
      »
      »
      4 months 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

      • »
        »
        »
        »
        4 months 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.

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

          Thanks!! I understood the problem.

»
4 months 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