cyand1317's blog

By cyand1317, history, 6 years ago, In English

Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)

I'm delighted to invite you to Codeforces Round 487 (Div. 2), which starts at Jun/11/2018 16:35 (Moscow time). Please note that the timing is, as usual, unusual.

This is my third time creating a contest from scratch. Along the way can be seen the efforts of: KAN the super-ultra-hyper-mega-meta coordinator, who has reviewed, refined and translated the problems; 300iq, Livace, mike_live, Noam527, RobeZH, and Tommyr7 the super-ultra-great-delicious-wonderful testers, that have populated our collection of solutions; and MikeMirzayanov along with the super-ultra-extreme-awesomazing Codeforces/Polygon team, who have made all these happen in the way it is! Kudos to all of you!

The round will be rated for contestants from the second division, and the first division are welcomed as out-of-competition participants. There will be five problems to work on for two hours. The scoring distribution will be announced later, because of... love.

Despite my illiteracy, I included the stories in the hope that they'll be inspiring to some; feel free to skip them, if you'd like to fully concentrate on problems themselves.

We wish everyone a fun experience and a fair rating. We'll be pleased to have you on the contest!

Gone are the freshness and beauty of springtide, which raises the downheartedness in Mino the poet, as in many other poets. Mino's best friend, Kanno the painter, however, is intrigued by the changing palettes brought about by the seasons. On this day, their journey in search of spring begins...

UPD 1 The scoring is standard: 500–1000–1500–2000–2500. It's however strongly recommended to read other problems if you're stuck, since you may not necessarily find later problems harder. Good luck!

UPD 2 Congratulations to top contestants! Also big kudos to all participants!

Div. 2 Top 5

  1. olphe
  2. jorik
  3. amnesiac_dusk
  4. UtahaS3npai
  5. espr1t

Overall Top 5

  1. olphe
  2. mjhun
  3. Inner_x_Peace (First to solve E!)
  4. kobae964 (_That_ close! Integer division, maybe?)
  5. jorik

UPD 3 The editorial is out, see you there!

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

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

Cool announcement.

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

We need more announcements like this

This is the best round announcement ever

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

It says that first division will be out of competition. Even 1900-2099 ?

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

    Technically, no, since this is a Div.2-only contest.

    i.e. C.Master participants are also rated.

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

    It will be rated for everybody up to 2100. Participants with the ratings 2100+ are invited to take part unofficially.

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

Can you share the two round number you are talking about?

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

Really enjoyed reading announcement. Specially —
Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)
Please note that the timing is, as usual, unusual.
Gone are the freshness and beauty of springtide, which raises the downheartedness in Mino the poet, as in many other poets. Mino's best friend, Kanno the painter, however, is intrigued by the changing palettes brought about by the seasons. On this day, their journey in search of spring begins...

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

Programming Contest is my drug.

Codeforces is my dealer.

Thanks Codeforce for two consecutive contests in two consecutive days.

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

Is it true or not that 300iq have 300iq?

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

    It is not

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

      so u have more or less iq?(turn on ur sense of importance)

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

        I have 35 iq.

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

          I hope it is truen't

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

          Did you change your name on cs academy after the team selection for IOI in Russia? :D

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

            Yes, you are right :)

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

              :D I actually thought that this year you would pass.

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

the super-ultra-great-delicious-wonderful testers. Delicious ???

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

It is your way of writing that is awesomazing :D LIKE THIS ANNOUNCEMENT <3

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

cyand1317's round again!

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

it's will be nice contest for every participants

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

Hmmm.So bot[Noam] is replacing Human as Problem Setter :P

Only Discord Server will get it xD

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

Friends are the worst.

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

    Still everyone talks about the same. :( YES IT IS RATED FOR YOU

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

      This isn't me actually, my friends got my account open and did this to get me downvotes.

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

        My friends have been doing that too.

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

        Okay sorry then.

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

        Now you got (32-11) upvotes. Friends are the best. Hence proved.

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

          I guess you are right. I misjudged them. They just wanted some upvotes for me. I couldn't think it through.

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

Hope everyone could play the game well.Besides,how to increase my contribution?My contribution is below 0.

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

    There are a few [not] easy ways:

    1. Writing really useful comments.
    2. Writing really funny comments.
    3. Using breaking news to make a funny comment.
    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      Maybe you're new to codeforces. there's absolutely no rule. people get upvoted and downvoted for apparently no reason whatsoever.

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

cyand1317, you could change time and date as per this comment

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

Looking forward to this contest, good luck and high ratings.

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

Best announcement on CF!!!

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

My rating have just become 2101 after the educational round in yesterday. This round suddenly becomes unrated to me :(

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

Wow, Chinese contest creater.

And such a cool announcement!

Hope that the problems will be as friendly as the announcement.

( And without terrible DATA STRUCTURES.. XDDD

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

Will Mio and Yuko be the characters of problem statements?

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

    No, but they'll say interesting Hitokoto-word-kotoba's like Mio and Yuko do.

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

Is there a hacking round in this? If yes, what are the rules regarding the same?

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

    I think it happens concurrently with this round as default, where you can start hacking others on a specific problem after passing pretests and locking it.

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

    Yes. EDIT:

    Only the normal room hacking.

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

Huge problem statements -_-

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

    He did mention in the blog that you can skip the additional story..

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

1hour passed && only 1 Pretest Passed on problem D!.Really?Is it Div2 Contest?Or Typical Chinese round??

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

OMG, Prob.D&E is too hard...!

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

problem E will give nightfall to everybody

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

1324 hacked

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

What's the intended solution for E? I had idea for matrix exponentiation, but was getting WA on 3 :/

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

    Maybe I got the mistake in my thinking :|

    I was trying to find the answer for individual lines only, disregarding the fact that multiple lines can coincide :|

    But then this probably makes the problem much harder than what I thought during contest

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

How to solve c?

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

    Make a quarter for each letter, that will consume 1 component of each, and each group will have 25*25 letters. e.g:

    AAAAABBBBB
    AAAAABBBBB
    AAAAABBBBB
    CCCCCDDDDD
    CCCCCDDDDD
    CCCCCDDDDD
    

    Now put the rest of each letter inside the quarter of any other letter without touching each other, that way, each letter will have up to 12*12 components to create. e.g:

    AAAAABBBBB
    ABABABCBCB
    AAAAABBBBB
    CCCCCDDDDD
    CDCDCDADAD
    CCCCCDDDDD
    
    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      thanks for the help :).

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

      I know that in problem statement, number of connected components cannot exceed 100. But if we remove that constraint and have input as 1225 1225 1 1, then your solution will not work right ? Is there a way to extend your solution for above input ?

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

      Wooow !! Such an elegant construction

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

    Let the answer always be a grid of size 50 * 50
    Initially fill the left half with A's and the right half with B's
    Now to fill the remaining components make "holes" in each of the halves and place them accordingly.
    Suppose a = 3, b = 3, c = 2, d = 2
    The matrix will be (note that the actual matrix will have size 50 * 50 )
    AAAAA | BBBBB
    ABABA | BABAB
    AAAAA | BBBBB
    ACACA | BDBDB

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

    make 50 50 matrix , use 1 component of B to make all components of A , 1 of C to make rest of B and similarly for the rest. like if input is 4 4 4 4 ,then matrix would look like

    BBBBBBBBBBB(...upto 50 chars)
    
    ABABABBBBBB
    
    BBBBBBBBBBB
    
    CCCCCCCCCCC
    
    BCBCBCCCCCC
    

    CCCCCCCCCCC
    DDDDDDDDDDD
    
    CDCDCDDDDDD
    
    DDDDDDDDDDD
    
    AAAAAAAAAAA
    
    DADADAAAAAA
    
    AAAAAAAAAAA
    
»
6 years ago, # |
  Vote: I like it +1 Vote: I do not like it

how it is possible that in Problem-2 output for test case 2 2 .. is no?

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

    If p=n, then p is always a period. In other words, if x is the length of the string s, then x is a period of string s.

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

      p is a period of the string s if "for all i, 1 <= i <= |s|-p". Now if p == n, then there does not exist any i which satisfies above constrained. Don't you think this was ambiguous?

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

        No, I don't think so. The problem doesn't tell "There is an 1<=i<=|s|-p so that s[i]==s[i+p]", it tells "for every 1<=i<=|s|-p s[i]!=s[i+p]".

        Prove that 5 is not a period of the string "01101". Show such 1<=i<=0 so that i-th and (i+5)-th characters of "01101" aren't the same. You can't because there is no 1<=i<=0 so that i-th and (i+5)-th characters of "01101" aren't the same. So it is a period of the string "01101".

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

D is only about pen and paper :)

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

    Representing the time with a vertical axis will help save quite a little ink and paper. Just two different approaches :)

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

hack for B: n=2,p=1,s=".."

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

Problem E? What problem E? I don't see problem E but hundreds lines of my code for C & D.

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

    I thought C is pretty simple? Just fill the first 25 rows with A, the last 25 rows with B, and change the cells with even row and even column until there's enough connected component of each type.

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

      yeah ... I tunneled visioned real hard and tried to code a solution with 50 rows of A, fill holes for B C D, then fix A by chaining B C D holes together.

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

Not a good contest.

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

    Incorrectly estimated difficulties T^T

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

      Sometimes I hope that X-CPC regionals have some of their problems replaced by hard Div2 rounds.

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

      Don't worry, the problems are pretty fun :) I was also surprised to turn on and see no passed pretests for D and E 1 hour into the contest. I still think all problems are suitable for Div.2 users (though I might be wrong on E, will submit after systest).

»
6 years ago, # |
  Vote: I like it -9 Vote: I do not like it

less than 1000 people worked out more than 2 problems

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

    The real problem is less than 100 people solved D&E.

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

C fucked me up, was there an easy way I missed? Can anyone explain the solution?

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

    Not sure about simplest but this is how I did it. Use the whole 50x50 array. Fill in top half with A, bottom half with B. It sort of looks like a grid jail. Put C's and D's in alternating spots. Put remaining A's in bottom half and B's in top half.

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

    You can paint the four squares of 25x25 like this:

    AB

    CD

    and then in the square with the A you paint the D's you need in the tiles with both x and y even, do this for the other three squares and you are done. It works because 25x24/4>100

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

      Very cool. Interesting problem, but really hit or miss I think.

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

Does anybody know the possible hack for problem B?

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

In problem B, can p<=n condition be established? if p==n, 1<=p<=0 .

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

D is very near to this one: D. Contact ATC

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

    You can also observe that both problems were set by the same person... :)

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

    Actually they are similar in statement only: solving one problem can't help you solve the other one.

    When I saw problem 989D - A Shade of Moonlight initially, I misread it and couldn't solve, but solved another problem instead. That is how 956D - Contact ATC was created.

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

In question B, I got wrong answer in pretest 2 and I got penalty of 50 points. Wasn't it the rule that if your solution fails in pretests given in problem statement as samples then you won't get any penalty.Someone please clarify

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

    only if it fails on pretest 1

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

    only if it fails on 1st pretest,then you won't get any penalty.

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

    This rule is applied for the first pretest only to prevent the loss of points due to submitting a solution for a problem other than the intended one by accident, if any submission passes the first pretest but failed in any other sample/pretest you'll lose 50 points.

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

I got WA because print one whitespace after the answer. (http://mirror.codeforces.com/contest/989/submission/39151664 WA) (http://mirror.codeforces.com/contest/989/submission/39155233 still WA) (http://mirror.codeforces.com/contest/989/submission/39155400 pretest passed)

Umm.. Although this is my fault, I have never been wrong answered at least by writing '\n' or by inserting whitespace after the answer during every CF round I have participated in. I wasted few minutes(about 10min) and get one penalty because of this.

Is it possible to remove my first wrong attempt? Or is this just my mistake?

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

For problem B what's the answer if n == p?

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

    print('No')

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

      Maybe I'm misunderstanding something in the statement. Can you help explain why p is period if p == n?

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

        if p == n, the whole string is the period and each position in the period appears only once, so whatever occurs there becomes the position of the period throughout the string.

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

        You can think of it in terms of vacuous truth. if p == n there is no i such that i+p <= n, so all i's such that i+p<=n satisfy the property of s[i] == s[i+p] even though no such i's exist. Their count is 0, and 0 i's satisfy the previous property, so all these i's satisfy this property.

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

          Thanks all, I got it now.

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

          This is the most lame thing that can be added in a problem testing.Don't get offended but what was the setter trying to test by this thing?

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

    always No

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

    "No"

    Because the string must match the definition for all 1 ≤ i ≤ |s| - p s[i] == s[i+p]

    As 1 ≤ i ≤ 0 must be false, there does not exist an instance s[i] == s[i+p]

    Note: for all x P(x) is true means that there does not exist a P(x) that is false

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

    The answer would be no.

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

OMG second contest in a row i need 1 more second to press on submit button :D

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

So, as it seems to me, this round was really strange...

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

In Problem B, if p == n, we get a strange inequality of 1 <= p <= 0. So I think this problem has error regardless of answer.

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

    I'm not sure how you derived this, but thinking about it from the perspective of the problem, this condition shows that the period = n, so the answer is always NO, since we can choose the periodic function to be whatever string is given. Clearly there is no logically inconsistency, so your formulation must be incorrect.

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

      If p==n, Assuming this condition is true, then n values can not exist.

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

        I don't understand your logic, what do you mean they can't exist? There is no issue. Like if p=n=5, maybe we have 10101. Then we see a repeating pattern of 10101 every 5 (which is the whole string), so the answer is NO. What part of that logic are you disagreeing with? What doesn't exist??

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

    Yes it kind of amazes me that the setter penalizes for such a case which is ambigous.I was on the verge of solving C and then my solution got hacked due to this thing n==p and it never came to my mind that this could be the error.Really disgusting from a contestant point of view.

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

I have seen something "interesting".

When you know your rating will decrease, you asked your friends to copy — paste solution to get skipped. Then your rating will not decrease xD

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

    Ugly Bug in the system then

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

    That's why cheaters should get banned (at least for a few contests)

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

i was using substr function in my solution for the given question and was getting a runtime error in the case , but when i did the basic implementation it worked, not getting the runtime error as even a string of 100 letters worked fine on my compiler here is my solution link can someone help

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

    Try test "A". Since size() and length() are unsigned, 1 — 2 causes overflow, and your for loop runs from 0 to "infinity"

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

in problem B the given statement is,

a positive integer p is considered a period of string s if for all 1 ≤ i ≤ |s| — p, the i and (i + p)-th characters if s are the same.

so, if p == n there is no valid i which satisfies the given condition, hence there is no valid period, so shouldn't the answer be "YES" is this case. Costed me four WA.Can anyone provide any explantion!!! thanks

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

    In this case, give me i such that i and (i + p)-th characters in s are not same. You can't do it, so "for all 1 ≤ i ≤ |s| — p, the i and (i + p)-th characters if s are the same."

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

      this is like going other way round!!!

      if there is no i for which any valid period can be formed (i.e all the i && i + p characters are same) how can we say that the whole string is a period.

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

        String x and y are same if for every 1 <= i <= len(x), x[i] == y[i] Are x = '' and y = '' same ?

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

        Proposition: every red crocodile can fly. It's true, because there are not any red crocodile.

        In this case: for every i in {1... |s| - p} i ans (i + p)-th characters in s are the same. That's true too, because there are not any counterexample. So, string is period because it fits the definition.

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

          but I still can't understand. if p==|s|, can I find n(=|s|) satisfying 1<=p<=|s|-p(=0)? Which n satisfy this condition(n==p && 1<=p<=0)?

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

            There are not any n, which satisfy your condition. So, your condition describes an empty set. And for every element in empty set, any statement is true. For example, that i and (i + p)-th characters are the same.

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

'C' really made me crazy lol kkkkkkk was tough to me

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

I've written down several equations about Problem D, but thrown it away eventually. And I realized that wind speed is always positive after the contest. :P

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

Interesting problems, especially C. Can someone explain its solution?

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

    AAAAAAAAAAAAAA...AAA

    XAXAXAXAXAXAXA...AXA

    AAAAAAAAAAAAAA...AAA

    XAXAXAXAXAXAXA...AXA

    AAAAAAAAAAAAAA...AAA

    XAXAXAXAXAXAXA...ABA

    BBBBBBBBBBBBBB...BBB

    XBXBXBXBXBXBXB...BXB

    BBBBBBBBBBBBBB...BBB

    XBXBXBXBXBXBXB...BXB

    BBBBBBBBBBBBBB...BBB

    XBXBXBXBXBXBXB...BXB

    BBBBBBBBBBBBBB...BBB

    XBXBXBXBXBXBXB...BXB

    replace X to A/B/C/D

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

    I made a 50x50 grid, so that upper left 25x25 is filled with A's, upper right with B's and so on. After that you can put the remaining components to the grid by replacing some 1x1 areas with them.

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

That may not be the problems called 'Stupid problems'.Thanks for your work @cyand1317!

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

C is similar to this problem

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

    Wow, my problem finally collided with an AtCoder one... Thanks for pointing out.

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

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

Woaah... So many WAs on Problem B. :|

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

Why answer is "No" when p == n in B?

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

    Because you don't know what sequence is after N.

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

      There is no sequence after N. So how can you say that "you don't know the sequence after N".

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

        By reading examples on B. so I can say actually that is based on intuition instead of reading the constraints on B very carefully. (without considering whether constraint is really wrong like commented below)

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

    It should NOT be no. I sent a clarification about this mid round and here is the answer: Can you please clarify? Is the person that answered me wrong, or is it the testing? [EDIT] Or am I? cyand1317

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

      It is true that it's periodic, but problem asks if it's not periodic.

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

Regardless of whether the answer is always No, I do not think that the problem is not valid because there is no |s| that has length satisfying p==(n=|s|) and 1<=p<=|s|-p.

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

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

    MRW I mistyped one variable in both A and B and the pretests didn't catch it.

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

      Omg me too. I mistyped the array size in the last educational round (missed one extra zero), got ArrayIndexOutOfBoundsException :(

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

      At this rate my contribution will be higher than my rating :(

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

And Problem B, Why

http://mirror.codeforces.com/contest/989/submission/39152340

is Accepted?

9 3 101010001

4th and 7th is same so answer is No. but this source print 101010001. I try to hack this source, but console does not appear.

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

    Because s[i] = s[i+p] does not hold for all 1 <= i <= length(s) — p. For example, the 1st and 4th characters are different, so the above answer is acceptable.

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

    1th and 4th aren't the same so p can't be period.

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

I have met C before this round in atcoder.So it's unfair to those who did not meet it before.

»
6 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it
Input:
3 2
.0.
Output:
001(or 100)

This test data for #B was not added in the system test. It's seems that many AC codes can't pass this data.

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

    But I think the answer is 'NO'

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

      cause you can't change '0' to '1', you can only change '.' to '0'/'1'??

      Am I right?

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

        Sorry, I was too careless when I post the comment..

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

    We can't replace any digit that has already been given.

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

    You cannot change the tide information if it has been given.

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

and yet another hackforces round ends

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

Where can I found problems like C? I need to practice problems like it, I am really slow with those problems

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

    You're probably looking for problems about constructive algorithms then. Codeforces has many problems about them here. Not all of them are very similar to C, but some of them are.

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

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

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

Can someone please help me with my submission for problem B (test case 31) ? http://mirror.codeforces.com/contest/989/submission/39155370

EDIT:- when comparing character, I wrote if(c==1) instead of if(c=='1') and it costed WA.Damn :(. How the hell did it pass the pretests?

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

    Please note that the input has been truncated on the page. You may want to check your solution on smaller tests. You can also refer to the editorial.

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

      I resubmitted the code only by changing if(c==1) to if(c=='1') and it passed the tests.Somehow if(c==1) passed pretests.Its just my bad luck.

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

Ok, I am really confused here, this submission:http://mirror.codeforces.com/contest/989/submission/39169572 gets runtime error on test 3 while this one:http://mirror.codeforces.com/contest/989/submission/39170689 gets AC. All I do is switch the condition i<s.size()-2 to i+2<s.size(), why are they not equivalent? I spent nearly an hour of the contest trying to figure out my mistake, can anybody tell me why this happens so I don´t do it again?

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

    .size() return unsigned number, so -2 will cause underflow. And thus it is nice to use macro such as this: #define sz(x) ((int)(x).size())

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

      Ahh, now I understand. Thank you!

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

        Most compilers will give you a warning though. Something about "signed/unsigned" comparision. Always try to make it a point to look at the warnings and see what they say. There's a reason why they are there ;)

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

          Nice call! I compiled it with Xcode and it gave me a warning, I'll be more careful in the future.

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

Finally blue :'( Thanks @cyand1317 for this wonderful contest.

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

It's however strongly recommended to read other problems if you're stuck, since you may not necessarily find later problems harder. Irony at its best.

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

I certainly didn't like the contest, statements were way too poetic, and more prescicely problem B's. Besides I performed extremely bad (not because the poems, of course). On the other hand I liked problem C (didn't solve it either).

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

    Though a valid definition, it would've been clearer if we had explicitly stated that p = n is a period. We'll try to make the statements even better in the future. Meanwhile, there is always the option to request a clarification during contest :)

    Best wishes.

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

No DP or graph problems at all? :(

»
6 years ago, # |
  Vote: I like it -37 Vote: I do not like it

Problem B is wrong for p == n. Should have been unrated.

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

Can anyone explain problem E to me ??

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

duliu

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

Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)

Summers always in the air!! Brazil <3

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

    The host of this FIFA World Cup must be jealous of your winter.