When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

KAN's blog

By KAN, 7 years ago, In English

Hi!

The Codeforces Round 398 (Div. 2) is going to be held on Saturday, 18 February 2017 at 9:05 UTC for participants from division 2.

The round is based on XIII Nizhny Novgorod Olympiad in Informatics for high school students named after V. D. Lelyukh, which will take place on Saturday in Nizhny Novgorod. However, not all problems from the Olympiad are included into this round.

The problems were prepared by KAP, ashmelev, ZhNV, kuzmichev_dima, mmatrosov, mike_live, arsor and me.

You will be given two hours to solve five problems. As usual, participants from division 1 can take part out of competition.

Scoring: 500-1250-1500-2000-2500.

UPD: The contest is over, thanks to all who has participated! Congratulations to the winners:

Div. 2:

  1. lucyanna2018
  2. Imperishable-Shooting
  3. aduiduidui
  4. Cth1999
  5. mister_dudec
  6. FallDream
  7. Illidan
  8. Alex342
  9. A.Magdy7 and TmEnd

Div. 1:

  1. eddy1021
  2. HellKitsune
  3. I_love_Tanya_Romanova
  4. vintage_Vlad_Makeev
  5. latte0119

I apologise for the problem difficulty of the problem B, we expected much more accepteds. Hope you liked the problems! The editorial will be posted in 1.5 hours after the Olympiad is finished. Editorial.

We know about the issue with ratings, they will be rolled back and then updated properly. Don't worry.

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

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

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

    This comment has more likes than the blog.

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

Do not thank MikeMirzayanov? DANGEROUS!!!

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

** ** *****?

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

Wait, correct me if I'm wrong (not likely haha) but if someone has a friend who participated in the XIII Nizhny Novgorod Olympiad then he could technically get some advice from him regarding the problems... Are there any countermeasure for that or should we all try befriend some novgorodians?

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

    "The round is based on XIII Nizhny Novgorod Olympiad in Informatics for high school students named after V. D. Lelyukh, which will take place on Saturday in Nizhny Novgorod."

    I assume these rounds will run almost simultaneously.

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

That feeling when you open "Contests" tab and there's this

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

SOORY,BUT THIS CONTEST MAY BE UNRATED BECAUSE CF SEEMS NOT SO WELL

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

That moment when it's holiday but you have to wake up early to participate the contest :(

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

Wish the problems to be very Interesting! ^_^

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

i hope every one have good contest and i hope the problems be interesting and have many ideas.

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

I cannot register to the round, could somebody explain why ? thanks

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

The most creative(in aspect of the difficulty) contest ever, and in my humble opinion, no other contests will beat this dishonorable record :D

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

Love the change in friends standings page! :)

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

Nice and tiny questions You can solve them with push and shove

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

What sort of contest is this. I couldn't do any. #Senseless

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

Why I can see the questions of other participants?

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

    The most ridiculous question is "give me 5 test case" :D And he got answer

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

    At least I finally understand how frequent the admins received messages during a single contest. And I know why they sometimes respond slow. (I hope the high frequency of messages in this contest is not related to the unclear English statments)

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

One of the best problem sets in a while. Keep it up guys!

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

I do think the legends of the problems are toooooooooooo long to read. Maybe shorter legends and clearer problems instead?

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

Hardest Div2 B I've ever seen

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

scoring distribution should be 750-2000-2000-2000-2500

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

    nonono it should be 750-3000-1000-1000-2500

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

      1000 for C and D? It is not Div1 contest!

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

        Just mean to emphasize the interesting problem B...

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

Rating prediction for this contest could be found here or there.

Extensions:

As you could see unfortunately, it is bit difficult for my service to handle such amount of request. I'm sorry for that again, hope mirror solve this problem.

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

    RIP RATINGS

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

    The link isn't working. The page opens and shows some error HTTP Status 500 — An exception occurred processing JSP page /roundResults.jsp at line 15

    type Exception report

    message An exception occurred processing JSP page /roundResults.jsp at line 15

    description The server encountered an internal error that prevented it from fulfilling this request.

    exception

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

    This time the results were lot different. This shows -22 negative rating change whereas i almost got exact positive rating change.

    Edit: It seems something is wrong with cf rating changes...

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

      I hope my service doesn't broke codeforces:) Actually now on your rating graph your place in the contest is 203, but in standings it is 319.

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

how to solve B

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

    Even reds couldn't solve B :(

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

    At first, you must find such time between ts and tf, when there won't be anyone. The waiting time at this case 0. If there are always someone, then u have to find time among all pre-visiters, which is the smallest ( a waiting time, not arrival time).

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

    that's a popular "WTF so standard easy-peasy problem" among russians :D

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

    Lets try to stand in front of every person p in the queue — optimally, we need to come 1 minute earlier than p. Find the minimum of that waiting times (and don't forget to check will it be enough time to become documents)

    Before printing the answer check what if we will come after all persons — will it be enough time (t) to become documents

    Complexity O(n)

    Sry for bad english)

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

Someone Please tell Me What the hell was pretest 4 of div2B ?? Any ideas anyone. Wasted the entire contest reading the question and finding bugs on the same.

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

    Initially I assumed that the starting time can be any time < e. But I got 5 WAs on pretest 4, lol. When I changed it to start_time < e-t, then I passed that case.

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

      The problem statement clearly states "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)." Your answer indicates that the receptionist ALSO STOPS SERVING THE ONE HE IS SERVING. Did I get that right?

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

        Yes, I got confused by that line as well. :(

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

          Exactly if start_time<end-t then it means no visitors can be processed but the output statement states that there always exist an answer. So what should the answer be in such a scenario??

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

            There is probably no such input because "It is also guaranteed that Vasya can arrive at the passport office at such a point of time that he would be served by the receptionist."

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

        Yes it has to be "ALSO STOPS SERVING THE ONE HE IS SERVING.". I also had the same doubt and clarified it early (luckily). I believe problem statements weren't clear on this.

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

          The problem statement is extremely clear on this. In fact, it clarifies that the statement "stops serving visitors" does not relate to currently served visitor. Model solution and tests are simply broken.

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

            No I was wrong, the key part of the statement that I read incorrectly was "If the receptionist would stop working within t minutes". So the statement is concerned with time (end — t), like satyaki3794 said. After that time point the receptionist does not accept new customers, but he will serve the current customer through, and be done with him before end time.

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

        No, obviously not

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

    You can finish exactly in tf. Example: ts = 3, tf = 7, t = 4. It is possible.

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

How to solve A

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

What the Fuck ? It is impossible to solve the 3rd problem in Java if u use adjacency lists.Why >>>? I get MLE for storing the edges. Is this even fair ?

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

Was B binary search? I was trying to binary search between the times of the people in the queue and took the best one out of all the gaps but I couldn't get it to work.

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

    First check if there's a time before tf such that no one is waiting for processing. Then vasya can come at this time, and wait for 0 second.

    If not, and if there are k different arrival times in input, then try to see if there's a minimum waiting time possible for the preceding time for all these k values. Additionally, check the time after all values in input are processed, if then vasya can still get his request processed, before tf.

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

      Thanks! That makes a lot of sense actually.

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

        Can't access your code. You can check my submission. I wrote comments for everything.

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

          Can you link your submission?

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

    Just check Ai, Ai - 1, ts, and after all people. (Ai is arrival time of i)

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

lucky I skipped the 2nd one for last

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

Please, someone explain E to me. I think I reduced it to knapsack but with big dimensions.

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

    You don't need to do knapsack. You always choose one of these per day: paying with notes only OR paying exactly. And "paying with notes only" can be thought that you get 100 coins and some dissatisfaction. So greedy will work. Simulate from beginning. Whenever you don't have enough coins, choose a day with minimum dissatisfaction from the past and add it to the answer. Priority queue will be enough to implement this.

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

      Ooooh, we get the change back, I just ignored it :D Thank you!

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

I guess time limit for D is too strict, my Nlog(10^7) + Mlog(10^7) didn't pass.

Plz have a look and tell me if I am missing something: http://ideone.com/Tdob4l

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

    I think their intended solution is with time complexity O(n + m + 107). And I passed pretest with this time complexity.

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

      But shouldn't my solution pass too as it is well within 10^8 compuations?

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

        I think using set is with big constant on each operation like insert and upper_bound, which leads your solution TLE.

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

          I guess all operations of set takes log( set.size() ) time which I computed earlier, and then too I don't find a way where computation increase to 10^8.

          Can you plz tell when we should avoid set( as u say it causes TLE ) and use some other option as I usually see 10^8 compution( if exceeding then TLE )?

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

            Ummm... Just to understand using functions from STL may requires higher time as they are usually with larger constanst.

            For instance, writing binary search on your own is usually faster than using lower_bound from STL. Also, maintaining stacks or queues on your own are usually faster than using queue<> and stack<> from STL as well.

            You may try to have some experiments on performing million times of binary search written by yourself, and with the same case, test on performing million lower_bound.

            In cases that we can easily write functions on our own, and the problem TL is very tight, we should not rely on STL functions.

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

          Can you tell me how to pass memory limit? I used up to 262000 kb and cannot pass the test zz

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

        It is not well within 10^8 operations. If any of the cartons has size 10^7 then variable maa is also equal to 10^7.
        Before you begin calculating the answer you insert all integers from 0 up to maa into your set and this initialization itself takes around 2*10^8 operations.

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

          10^7 * ( log(10^7) ) == 7 * log( 10^7 ) ( Base 10 )

          10^7 * ( log(10^7) ) is approx 2 * 10^8 ( Base e )

          Are STL operations base 10 or base e as both gives different results?

          Yeah I realised that earlier from comments above and made it AC after changing variable maa threshold.

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

            I think the most of the time we deal with base 2 logarithms. Nobody bothers to mention the base unless its different from 2 (Correct me if im wrong). Since sets are usually implemented as red-black trees (according to cpp reference) i believe the base is equal to 2.

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

      I passed pretests in O((n+m)logM), but it was a tough battle.

      Input/Output took the most of time. TL was too strict imo.

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

      My solution passed pretest easily

      UPD And it passed all tests in around ~1 sec

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

    Strange, my solution which is O(Xlog(N)) passed, where X = 1e7

    http://codeforces.com/contest/767/submission/24774891

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

      Maybe judge data was weak.. I don't see any number fi, si being 107 in the tests. I can see that there are maximum fi, si ≤ 9 × 105 :| Then O(xlogn) passes simply.

      Also even if x = 1e7 then it can pass also :) O(1e7 log 1e7) O(2 * 1e8)

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

      Lucky you optimizing I/O operations... cannot do this in C#... :P

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

    Yeah, time limit in D was too strict.
    Submited using :
    Binary Search and Sorting : TLE on test 8 24776219
    Binary Search and Two Pointer with cin/cout : TLE on test 9 24776253
    used scanf/printf : AC 24775689

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

Hard Problem set, but atleast now I learn how to use set :)

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

When you find out your solution to B is wrong 1 minute before the contest ended... :(

I have a feeling many B solutions will fail system testing...

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

Nice problemset. A-C were awesomem very good tasks

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

B is hardest than D

Logic R.I.P

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

    I'm sure you meant "harder" instead of "hardest" :)

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

Maybe it should be Div1 contest istead of Div2 ? :)

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

Guys! English!!

What the heck with problem C. I understood the problem from context, not from the description. Please don't use translators, ask someone who speaks English well to translate statements.

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

    I understood it from the picture :D :D Yeah, the statements suck a lot.

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

      The worst was understanding the input. They interchanged lamps with wires throughout the statement.

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

    This sentence in problem D : "The main issue Olya has is the one of buying new cartons."

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

      RIP...English.

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

      This sentence in problem B : "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)."

      I got 1 wrong answer before I realized, the receptionist leaves exactly at tf, even if somebody's request is partially completed.

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

Was problem C greedy tree dp? My approach was to find a subtree of weight of dp[root]/3 and remove the weight of that subtree from its ancestors' weights. Then I try to find another subtree that has weight of dp[root]/3 and we are done.

Code: Link

Is this approach correct?

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

    Yes.

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

    In addition, the height of the firstly found subtree should be highest possible, so that we can increase the chance finding the second one.

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

How to solve C? I am getting WA on pretest 8 and 10.

My approach -> If totalheat is not divisible by 3 return -1. Check if we can find two subtree of totalheat/3 then return those 2 values. Check if we can find a subtree with heat totalheat/3 and and it's parent with heat 2*totalheat/3 then return parent and that node. Else return -1.

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

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

    The general idea is correct but your solution fails at both cases. You need to check that two subtrees of weight totalheat / 3 do not intersect and checking that immediate parent has weight 2 * totalheat / 3 is not enough — it could be parent's parent that has the weight 2 * totalheat / 3.

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

    While calculating weight of subtrees, whenever weight of a subtree equals totalheat/3 push it into ans vector and return 0, because it will not be contributing in it's parent. It will handle the removal of that subtree.
    24775716

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

The problem-set was nice, but I feel that the difficulty levels of the questions was jumbled up. I found A<D<=C<B<E, in order of increasing difficulty.

RIP Rating

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

Can someone tell me why printing 16 gets WA on problem B pretest 2? I think I miss something in the statement but it says: "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)."

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

Now you know why there are 8 writers: we need people to draw the cartoon and to write stories. :P

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

    Maybe next time we will need people to properly explain these stories in English :D

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

398 (Div.2̶ 1)

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

i am not sure if this was a div2 round or div1 round sorry to say that but it was one of the worst rounds i have ever seen here

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

good contest for DIV I contestants, Div II contestants RIP

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

My first DIV1 contest.

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

C was awesome...D was a little easy for a D problem (they should have been swapped)

I didn't read B but judging of the number of people who have solved it it must be really hard for a B problem

The statements were rubbish..they were way longer than they needed to be (that's why I didn't solve B...skipped it after seeing the statements)

But all in all the contest was great.

(don't downvote me guys it's just my opinion)

:)

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

    it was great because you didn't read problem B

    but who read problem B and tried to solve wasted too much time while problem D was easier to solve

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

It so frustrating when you solve problem but can't pass tests because standard reading method, you used all the time, doesn't read fast enough for this input. I have linear time solution for C but probably reading method I use in my C# solution too slow. Now I think that string.Split() is just too slow for this problem. Don't enjoy such contests.

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

    I have the same I/O timeout problem for problem D also for C#. Spent the entire contest time trying to figure out why I am getting timeout on test 9.

    I also don't welcome this situation. The official answer was that "It is not guaranteed that a solution exists for all languages". Well, c'on... I have seen some folks with solutions in C++ and still getting timeout on test 9, probably for the same reasons (since some are Div1).

    I would like to thanks the organizers for setting up the contest of course, really enjoyable, but cannot but feel disatisified with taking a big rating hit for trying to solve a problem which is unsovable given the time limits without optimizing I/O.

    Really, this is a known issue. My opinion is that the limits should have been increased to 3 or 3.5 seconds to allow for such reads. This will still not make an n^2 fit but will allow enough time to I/O...

    Didn't even have time to read the others except B (which also has a very long text...). My opinion is that weather this particular contest should be rated should come into question.

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

Am I the only one who practice translating hardly?

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

Lowest solved, highest wrong answer :P "long live 398 Div#2"

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

Be stucked in Problem B. RIP my rating. :<

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

Contest should be unrated.

Bad translations, long statements and very hard B.

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

Olympiad Student 1 pass : olympiadolympiad

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

is it rated?!

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

    only for Div.1 participants ;)

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

      No please:) I just resubmit without thinking when i stuck at some problems. Many pretests failed including failing pretest 2 :)

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

Vote here. They can make contest unrated.

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

    I liked the problems. They were harder than usual, but they were harder for everybody, not just you. Why make it unrated?

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

      I would vote for unrated because there were several issues with timeouts due to I/O operations taking to long (for example in C# for problems D and I understand also C).

      I would really have enjoyed this contest especially due to the harder problems however if despite a sound solution I have to spend the entire contest time to figure out I get timeouts due to I/O, then.. I would go for unrated.

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

        Maybe you should avoid using slow languages in competitions.

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

          Thanks! Never encountered this problem until now though. Usually the limits are better thought to allow even C# and Java solutions to pass.

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

    do not worry, your name will fit your new rank haha

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

Fastest Systest ever... no wonder, since there was so low total number of submissions.

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

How to solve E?

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

4 6 2

0 1 1 1

2 2 2 2 2 2

Are cases like these not in system tests? At least two of my friends will output -1 for this test but I believe all the cartons of milk can be drank, right?

In fact, my friend will fail if there is no 0 in the first line but a solution still exist. This apparently is not in the systests however ==

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

    Shouldn't the answer be -1? We can drink carton 1 and 2 that are inside fridge on day 1 but how can we drink carton 3 and 4 on day 2?

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

      You can just drink them lol. They are not expired yet.

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

A. Pretest 5 should be a systest! There should be more possibilities to hack.

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

problem B test case 3 :

input:

7 14 3

2

1 2

output:

13

answer:

0

statement says :

The receptionist spends exactly t minutes on each person in the queue. If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves).

my output should be correct

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

    Yes I have the same question too for my submission. Please someone to answer us.

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

    Your output is 13, while if Vasya visit t = 13, the receptionist would not serve Vasya as the reception cannot close before tf = 14 because it requires 3 minutes serving Vasya (from t = 13 to t = 15).

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

      Yea but the statement says "(other than the one he already serves)."

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

        Which means someone he is already serving, and not people who are in the queue waiting.

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

        I think the receptionist will choose to serve a new comer or not, based on whether if the receptionist can serve the new comer fully before the close of reception

        So for "the one he already serves", they mean those being fully served as the receptionist will choose not to serve the new comer if the new comer cannot be fully served.

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

        Yeah, but the statement also says "(so that (tf - 1) is the last minute when the receptionist is still working)". So (I'm also not happy to admit), from the statement, the answer to case 3 is indeed 0. Dammit!

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

    same problem here i was stuck with that test case

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

    Let's rephrase the last sentence : "The receptionist will not accept new customers during last t minutes, but she will finish serving those who came until time t_f - t" I misunderstood this statement during contest as well, but fixed my code easily with this new insight (compare 24774069 and 24775470).

    IMO, pretest 3 should have simply been added to problem statement and all would be much better.

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

      I see. Thanks for the answer. Personally I am not so good in english and I find the translation terrible. I suppose that many others feel the same and that this bad translation costed to us time and rating.

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

    I faced the same problem

    this system test is the worst of all

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

    My solution failed system tests just because of this 'error' in the problem statement. Maybe this is one of the reasons why B had so many successful submissions.

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

      KAN MikeMirzayanov Could you please provide some clarification as to what that statement meant? Some other used asked during the contest and he was clarified what it meant. Should not that have been an announcement for everyone?

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

        As others mentioned, the statement is: "When there is t minutes before tf, the receptionist stops serving new visitors, and only finishes serving the one which is already being served."

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

          Unfortunately, I do not see that line in problem statement. All I see is "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)." And I do not think many people would agree that both the statements mean the same thing.

          The problem statement should have been more clear :)

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

    This part of the statement explains why the answer to case 3 is 0:

    "(so that (tf  -  1) is the last minute when the receptionist is still working)"

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

System test gives WA for all submission for problems D &E

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

WTF is wrong here, it says my D is accepted but in standings it seems like it failed — http://store.picbg.net/pubpic/6A/71/96070172827f6a71.png?

UPD: That's the case for everyone, now I see...

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

I do not know why everyone says that problem B was difficult, it was just a simulation and greedy, for me it was more difficult to solve problem C

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

This was the worst contest for me — I began with C, did it. Then tried D, but failed on some pretest. At this point I had just 20 minutes left, so I went back to A and B. I got A, but with a very low score, then wrote B. I had a small bug, which I found. I was just about to click submit when the contest ended(I had already selected the file). In the end, my C fails system test. :(((

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

I've got a question. This is test 4 for B problem:

30 70 10

3

30 32 35

Why is the answer 60? Isn't the queue supposed to close a tr — 1 = 69?

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

    If Vasya visits at t = 60, Vasya is served from t = 60 to t = 69 which consists of 10 whole minutes. So the reception can close at tf = 70.

    so that (tf - 1) is the last minute when the receptionist is still working

    By this, the receptionist still works at t = tf - 1 = 70 - 1 = 69.

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

What's going on with the standing? They are giving fail in spite of passing? NVM, it got fixed

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

What kind of time limit has been set for the 2nd problem ?

What fool did it ? Who is this foolish person who set this problem ?

Submissions :

  1. Java (During the contest), MLE : http://codeforces.com/contest/767/submission/24771836

  2. C++ (After the contest), AC within 1310 ms : http://codeforces.com/contest/767/submission/24775207

Such a negligent attitude is rather bad, and I dont think deserves a place on CF. The two codes are 150 % identical, expect they differ only and only in language .

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

    Dude think before calling the problem setters foolish. They are doing this voluntarily and you should be thankful to them instead. Sometimes there are some negligences, but you shouldn't call them foolish at least.

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

Is this proper test for B? Is only Vasya can come at midnight (at time 0) ? 0 7 2 4 0 0 0 6

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

I was deceived by the unusual input of C which is tree data

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

In problem B, for the 3rd pretest:

7 14 3
2
1 2

My answer was 13. Why is it wrong? In the condition it states: If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves), so I assumed that means he should enter before tf but doesn't need to get out before tf. Either I'm missing something or the condition was wrong.

Whoops, someone already posted the same question, sry.

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

    same problem here

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

    MikeMirzayanov please look into this

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

    If you go at time 13, the receptionist would stop working within 3 minutes(actually after 1 minute the person will stop working). So you can't get served.

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

      (other than the one he already serves), this means that he keeps serving the one she already servers.

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

        No, that means, say, assume you go at time 9 and start served. At time 11 the receptionist would stop working within 3 minutes, but the server continues to serve you.

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

        I think the receptionist will choose to serve a new comer or not, based on whether if the receptionist can serve the new comer fully before the close of reception.

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

    You won't be served if you come at 13, because the queue closes T seconds before the end.

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

      (other than the one he already serves), this means that he keeps serving the one she already servers.

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

        But he comes after than T seconds before the end, so the queue is already closed. He isn't even start getting the passport.

        The idea behind the phrase is the following one. Suppose T = 5, Tr = 20. If you come at 13 seconds, you will be served even if the queue is supposed to close at 15. If you come at 18, however, you aren't served.

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

    Oh yeah, I just read that wrong, my bad, missed the "within t minutes" part. I should buy new glasses xd.

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

In problem B This test case: 7 14 3 2 1 2

The output of the judge is 0 however i am printing 13 and he tells me wrong why he can come at min. 13 noone is there so he can enter as the 2nd one finishes at min. 13

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

 I got 17th place, but it is showing that I got 49th place.

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

    I finished 316 , but rating update says that I finished 2236... looks like "D" was not considered in rating update somehow

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

      same here I finished 263 but says that I finished 2017

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

    Same problem here. It looks like the rating was calculated before system testing.

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

    Same here. This shows I got 108th place while this shows I got 347th place.

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

    Looks like cf has broken.

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

    same here !

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

That moment when only A is accepted but I have new best rating lol.

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

MikeMirzayanov Rating change is weird.

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

Why does it say I am in position 656 or so if I'm in position 97? My rating went down when it should have gone up. Please help

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

Why is everyone's D on the scoreboard wrong?In status I see I have accepted it.But the rating have changed according to the scoreboard .

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

MikeMirzayanov how come the same test case pass in the pre-test and fail in the system test, my solution is anyways has a bug but I'm just curious.
http://codeforces.com/contest/767/submission/24762072

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

Cheaters On Problem D:
Hasan: Submission
M.A.H.M.O.O.D: Submission

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

hi .. there is a problem in standing now .. my soultion for D is accepted and apper on my standing -1 !! and i haven't points and my rate is decrease !! how !!??

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

on the contest standings it says that I ranked 103(without unofficial participates) but on my profile it shows that the last contest I did (#398) I ranked 289

Can somebody look into this because it will effect my rate a lot ?

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

Seems the problem with D&E standings display also affected the rating changes... Is there anyone fixing this?

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

Ahhhhhh,What's the matter? I think my rating is too high.

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

my submission of problem D showed accepted in "My submission",while the final score is calculated without the score of problem D. what is the problem?

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

Question C: That moment when you realize that abs(1/3 * total) < abs(total) doesn't hold if total = 0.

EDIT: total -> abs(total)

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

When you solved 1 problem but your rating still increases

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

I want to know why my rating -48,In this conteset my rank is 124, but the profile's rank is 980,why ? Sorry,my English isn't well

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

this happened because you didn't say thanks to MikeMirzayanov

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

Strange rating change. It seems like problem D is not considered.

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

Problem B statement is wrong.
"If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)."
I submitted without considering above statement, my solution got accepted.

»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it
More points but less rating increase
»
7 years ago, # |
Rev. 2   Vote: I like it -38 Vote: I do not like it

.

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

    The contest is already unrated for you!

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

    Which test is not correct? Easy to say sth. like this without mentioning a specific test

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      7 14 3
      2
      1 2
      Answer should be 13 instead of 0.
      Problem is occuring because of wrong problem statement.
      "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)."
      
      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        even i had that confusion and had 4 WAs thanks to that. then i asked in the question section and got clarified.

        As codeforces's popularity is growing day by day, I think they should take an effort to provide better English statements.

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

          Either round should be unrated or submissions must be retested based on the problem statement.

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

            If it gets retested, a lot of AC ones will get WA.

            I don't think this happened for the first time in CF. It happened a lot in the past too and none of those round was declared unrated...

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

        I fail to understand why it should be 13? If you arrive at 13, you won't be served, because t_f is 14 and 13+3 is > 14?? This complies with the problem statement.

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          "If the receptionist would stop working within t minutes, he stops serving visitors (other than the one he already serves)."
          This implies that even if you arrive at 13 you will be served.
          
          • »
            »
            »
            »
            »
            »
            7 years ago, # ^ |
            Rev. 4   Vote: I like it 0 Vote: I do not like it

            No, he will already stop serving new visitors after 14-3 = 11 because then current time + t > 14! This is what it implies...

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

            "He already serves" not "he is serving". There is nothing wrong with the statement. Check your English.

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

Please, next time spend your energy on writing more clear problem statements instead of drawing pictures to all questions.

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

well, feel lucky not to compete in this round- - seems easy but actually…er…you all know now.

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

    after read the problems carefully…regret? D & E seems extraordinarily easy……than B

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

How is the rating calculated? I ranked 21st in the contest,but the rating dropped by 20! I'm the only one whose rating dropped among the top 88 people,including those whose ratings were initially higher or lower than me.In particular,there are many people whose initial ratings were higher than me,scored lower than me in this contest,but their ratings rose sharply!How could this happen?

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

We know about the issue with ratings, they will be rolled back and then updated properly. Don't worry.

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

In pC, when I hacked others with 4 0 1 1 -1 2 1 3 -1 The verdict of the hack is an unexpected error...... Just wonder whether this kind of testdata are already in the system test or not...

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

 Why rating changes is not logical ....

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

why? same original rating , higher rank,lower rating? feel sad QAQ!

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

LOLImage and video hosting by TinyPic

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

The problems D&E were even not considered in standings on my IE ,but fortunately now it has been fixed .Just waiting for the fixing of rating changes now .

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

Hard but interesting problem set. Thanks for your work and I also appreciate the strong pre-tests!

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

Can someone provide me some good questions for practice on DP on trees.?

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

KAN How this Code get AC ?!
test:

3 1 2
1 1 1
2

Code Output :

-1

Expected Output :

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

I think score distribution should be change

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

KAN
How can this code http://codeforces.com/contest/767/submission/24788498
24788498 get AC test case
5 20 4
4
0 0 10 14

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

    This is invalid test The third line contains positive integers in non-decreasing order the time of the visitors must be positive, it can't be 0

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

Wow! I got three 98 in Codeforces Round #398!

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

i think the problem is good , not only degree of difficulty , but also the trick . forever , the difficulty classification is so bad , the D is easier than B and C i think A D B C is better than the round .

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

Solution for B: ~~~~~ ~~~~~

long min = 0;
        long mins = ts+t;
        int pl = 0;
        for (; pl<n; pl++) {
            if ((ts+(pl)*t+t<=tf) && (ts+(pl)*t+t-(mas[pl]-1)<mins))
            {
                mins = ts+(pl)*t+t-(mas[pl]-1);
                min = mas[pl]-1;
            }
        }
        System.out.println(min);
So easy...
»
7 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

I wonder why this 24795199 got WA. I need help.

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

I found a test case which is
6
2 -1
3 1
0 1
3 -1
4 1
5 -1
Both my friends passed the problem, but have different output,
their submission are 24775420, 24775421
the first one output 2 5, which I think is correct, and the second one output -1
Do the sys test miss the test case like this?