Автор 300iq, история, 9 лет назад, По-русски

Всем привет!

23 апреля в 19:35 по московскому времени (время в вашем часовом поясе по ссылке) состоится рейтинговый Tinkoff Challenge — Elimination Round.

Задачи готовили я — Ильдар Гайнуллин, Александр wrg0ababd Курилкин и Николай KAN Калинин.

Большое спасибо Владиславу winger Исенбаеву и Александру AlexFetisov Фетисову за тестирование, Николаю KAN Калинину за помощь в подготовке раунда, а также Михаилу MikeMirzayanov Мирзаянову за системы Codeforces и Polygon.

Участникам будет предложено семь задач и два часа на их решение. Разбалловка будет объявлена ближе к началу раунда.

Этот раунд — отборочный раунд Tinkoff Challenge, анонс которого можно прочитать тут.

Лучшие 30 участников получат теплые жилетки и мелочи, в духе наклеек и блокнотов. Первые 100 мест приглашаются на экскурсию в московский офис с панорамным видом на Москву.

В финальный раунд в офис Tinkoff приглашаются 20 лучших участников отборочного раунда из числа тех, кто сможет приехать.

Надеемся, каждый найдет для себя интересную задачу. Всем успешного раунда и повышения в рейтинге!

UPD. Разбалловка: 500 1000 1500 2000 2500 3000 3500

UPD. Разбор

  • Проголосовать: нравится
  • +424
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Nice anouncement, hopefully the problems will be cool. Good luck to everyone and no rating drops!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Nice announcement. Hopefully all the problems will be cool. Good luck to everyone and no rating drops!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +157 Проголосовать: не нравится

My profile picture advertises Tinkoff nearly a year. I think that I deserved automatic invitation for the final :)

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -52 Проголосовать: не нравится

Wishing problem description will well translated in english.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -80 Проголосовать: не нравится

.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -37 Проголосовать: не нравится

Is the round rated?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +144 Проголосовать: не нравится

Are travel cost and staying cost paid for top 100 participants?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +15 Проголосовать: не нравится

Just a begginer's doubt: From what I understood, the round will be rated for codeforces, but shouldnt it therefore be called "Codeforces Round #411 — Tinkoff Challenge" or so?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone tell me how difficult it is

»
9 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится -44 Проголосовать: не нравится

/

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

The name "Tinkoff" sound super cool to me, though I don't know Russian. I really want to get the Tinkoff vest!!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Hopefully the statements will be short not like Google Code Jam yesterday xD xD

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Any previous round of Tinkoff Challenge?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Is this contest rated for div2(<1900) people?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Это раунд вида "div.1 + div.2 combined" по уровню задач(round D = div2D = div1B)?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +23 Проголосовать: не нравится

Let's stay up late tonight!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -13 Проголосовать: не нравится

Will this contest be rated for all?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i registered 5 hours ago successfully, no doubt about that. But now showing i am unregistered :O :O , also that happens to one of my friends also. please fix this.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Will there be any geometry in the contest?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +19 Проголосовать: не нравится

Why? UPD:Fixed

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Still no scoring announcement?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +52 Проголосовать: не нравится

55 minutes after the end of Tinkoff Finals, GCJ Round 2 begins. I wonder if the Finalists can participate in GCJ.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +50 Проголосовать: не нравится

Seems like the round is delayed for 10 minutes (19:45 MSK). Then right after this round is finished, El Clasico will be started. :")

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

I wanna watch el clasico...please Start it soon :((

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

10 minutes late.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Was the contest delayed? I thought it was at 19:35MSK but it looks like it's at 19:45MSK.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

This contest has the most beautiful timing I have ever seen. Actually I am very happy because I don't have to wait for the system test.It's El-classico after this contest.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why delay in contest time?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Are the judging servers frozen or something?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

Long Queue :/

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Что не так с 24-ым тестом в задаче D?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

что за 7 тест в задаче С?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

Well this round certainly "eliminated" me.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Anybody knows the reason of WA10 on C?

»
9 лет назад, скрыть # |
Rev. 7  
Проголосовать: нравится +46 Проголосовать: не нравится

In problem D debugged 1 hour in test 4 and find out the edge is directed in the last 5 minutes and don't have time to optimize...

#ggneedaglasses

PS. More unfortunate, I set wrong initial value for my dp array and led to TLE.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Очень радует, когда много задач на идею, и не нужно много реализовывать !)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +80 Проголосовать: не нравится

B и С очень интересные.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

Someone fooled me by #define int long long :(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

How to Solve C?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I did ternary search to get when will a mouse be inside, then binary search in both directions to get the total interval each mouse will be inside

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    Use binary search for the time. You can check if after some time the mice has went out already of the trap, is inside it, or hasn't gone to it yet.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится

    First, you can see that a mouse will be in one segment of time (tEnter; tLeave) (or it won't be in the trap all the time, then the answer is -1). To find these segments, we can find intersections with the lines that make a rectangle.

    Then, we make the events such as {mouse x came to trap at time t} {mouse x came out of trap at time t}. Sort them and process consecutively. If we found the "came to trap" process, we increment the amount of mice, otherwise decrement. If we found in some point of time that there're n mice, we just output this period of time.

  • »
    »
    9 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +29 Проголосовать: не нравится

    Let's pick a single mouse. Assume for simplicity that vx > 0 then the mouse will be in the right x area if x1 < rx + tvx < x2 which is equivalent to requiring that (simple algebra). You can do something similar for vx < 0 and when vx = 0 you either pick the empty interval or all of [0, ∞) depending on whether x1 < rx < x2 or not. When you do the same thing for y and intersect these two intervals, you'll get the time during which this mouse is in the trap.

    Do this for all mice, intersect all of these intervals and pick the smallest non-negative value it contains.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Hack case for C?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +68 Проголосовать: не нравится

for C , double -> WA , long double -> AC
UPD:WA

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +52 Проголосовать: не нравится

Пока решения не проверились, я могу быть хоть более-менее объективен. У меня вагон и маленькая тележка причин опасаться за своё решение по задаче C. Такие задачи, на мой взгляд, очень не подходят для формата CF, ведь маленькая бага в верном решении может стоить слишком дорого. Задача слишком багоопасна.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +5 Проголосовать: не нравится

    Целочисленное решение с использованием long long зашло. Больше не буду начинать раунд с таких задач, слишком тяжело психологически писать и тестировать локально такую жесть. Я бы поменял эту задачу местами с D.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is c ternary search on max distance between point and rectangle?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Can anyone tell me if this approach is correct for C?

Binary search on the time. Translate each point. If the line from the original point to the new one intersects the rectangle and isn't inside the rectangle then I need to lower the time. If the line doesn't intersect the rectangle then I need to raise the time.

If I need to both raise and lower the time, the answer is -1. I couldn't get past pretest 4 (I also made sure to find all corners of the rectangle since they didn't give the top left one).

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Why is the hacking page so unstable? I really wanted to hack, but the page was just showing "loading circle" infinitely.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +230 Проголосовать: не нравится

IMO problem C ruined the contest

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

Task were tehnical, tehnical and tehnical.

Good bye, my rating.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

Didn't read this for almost 50 minutes, got WA 7 times, :'(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +143 Проголосовать: не нравится

I'll probably get down votes for saying this but I really did not enjoy this contest. The problems were not interesting to solve — just extremely annoying.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I think this problem can't be B problem :(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +114 Проголосовать: не нравится

Contest duration was obviously not long enough.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How to solve D, I had following dp state -> (left,right,start,k) where [left,right] is allowed range, start is always left-1 or right+1 and k are required number of nodes to be visited?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Can anyone explain how to solve D ? thanks!

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    you can use Dynamic Programming Your state is (int start,int end,int current,int taken) indicating left boundary , right boundary , current position and number of visited offices note that the state can be redefined to save some memory i hope it's efficient enough to pass xD

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    dp[l][r][last][k] = min cost when you can move in l,r and last city is last and we visited k banks. But it is slow. So we can notice that l or r will be equal to last, and we can remove r so it will pass.

»
9 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +13 Проголосовать: не нравится

So hard problem for B :(

I wasted about 40 min on it :(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there an error in the following function?

Get Time Inside Of Rectangle

I get the time to reach each of the sides of the rectangle and get the min/max from these 4 values. If the code is not clear, please tell me about it and I will try to improve its readability.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -17 Проголосовать: не нравится

Too many real number problems now a days. Too many precision issues while solving such problems. I estimate atleast 2X people would have solved problem C today if we had to deal with integers only.

The real number part is such an unnecessary complication to a rather not so difficulty binary search problem.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Test for problem C:
2
0 0 2 2
-1 -1 1 1
1 0 -1 1

Upvote if your solution fails it)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

I think problem D was a nice DP of the form Dp[d][left][right][v]. Where this value stores the cheapest path starting at v of length d using vertices only between left and right. Unfortunately I stored my vertices from 0 to n-1 and forgot to subtract 1 in the input. Now I'll have to wait a bit to check if it was correct.

Very Nice Problems, thanks.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

Am I the only one who did C like this:-

Consider x and y coordinates separately, and for each mouse calculate the time interval [t1, t2] such that it's x coordinate will be in (x1, x2), and similar for the y coordinate using math. Handle cases where Vx or Vy = 0 separately (either they will give (-inf, inf)) or impossible.

Then take the intersection of all such time intervals to find the answer. Is this correct?

Link to solution

(Might not be visible just yet I guess)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D? I've tried to run floyd-warshall with a slight modification in the relaxation step: if (i < k && k < j) continue;. For all paths with length k (number of offices), my answer was the one with shortest distance.

What am I missing?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +66 Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

Statement for problem C is awful, just awful. It never explains what 'strictly' means exactly, and the sample picture leads to the wrong conclusion.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

In B, what on earth test case 9 could've been? Got many TLEs on it, while having tested my algorithm for large inputs. Had to use a clock with time checks to bypass it :c

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

That moment when a legendary grandmaster hacks you (⁄ ⁄•⁄ω⁄•⁄ ⁄)

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +102 Проголосовать: не нравится

Nice difficulties (except for too complicated B, unless you didn't expect people to implement dfs) of problems but the contest was too short.

Please add more samples, especially to check that contestants understand the statement correctly. In B we had h = w. In C, samples didn't check for "strictly inside". In D — undirected edges also worked.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

I don't know why CF sticks to 2 hour contest time. I haven't seen a rated round with more than 2 hours. I know it's about speed also, but sometimes (for example now) we could really use 30 or 60 more minutes.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится

Why system testing is so delayed and still pending ?

Update: System testing started now :)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

I need some help in Problem C.

My Wrong Approach is :

For every mouse I get the time when it (enters) the rectangle By getting the intersection between the line made by the mouse and the 4 segments of the Rectangle.

If there is a mouse which will never enter the Rectangle or will stay forever on a border I will output -1.

Now I will get the time T at which the last mouse will enter the rectangle.

I will check that all the mice after time T will be in the rectangle or on the border of the rectangle. If this is true then I will output T, otherwise -1

So What is wrong with my approach ?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

How this can be rated contest for div2?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can we see others' solutions please?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +119 Проголосовать: не нравится

If you interpret it literally, the statement of problem C had a small problem: If all of the mouses are not already inside the mouse trap when the time starts running, there won't be a minimum time when all of them are strictly inside it. I guess that the problem was intended to have asked for the infimum of those times, but if the mouse trap is closed precisely at that time, some mouses might be on the boundary.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +28 Проголосовать: не нравится

    That's right, according to the formal statement, the only possible right answers are 0 (if the mice are already strictly inside at moment 0) and -1 (since there is no "minimum number strictly greater than a given number"). So, the statement formally contradicts the first example. Which is bad (Captain Obvious here).

    I remember the same exact issue handled gracefully in a statement here at Codeforces in the past, but don't remember the exact problem. If someone does remember (past coordinators perhaps?), please give a link!

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    So the answer is always 0 or -1?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    So basically the time that at least some accepted solution outputs (for example, my solution in the upsolving) is the time, when at least one of the mice is on the border of the rectangle, and that's, strictly speaking, OK, because absolute error is infinitely small. But, if there is no such moment (for example, mice "meet" strictly on the border), the answer is -1, which is logical, but feels weird for some reason.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

WHEN YOU FOUND A SOLUTION FOR PROBLEM B AND CODEFORCES SAYS TO YOU "CONTEST IS OVER"

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +31 Проголосовать: не нравится

Ориентированные дорожки, серьезно?) С условием было тяжело, несколько задач пришлось перечитывать и разбирать на семплах. B по-моему уже была на каком-то раунде. И тогда задача не казалась сильно интереснее. Интересно, что в G все отправили, надеюсь авторы тесты сделали к такой задаче.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I alone think that this contest required 2.5 hours as many Combined Rounds before?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

nlog(n) did not work on first problem. I unnecessarily sorted the array :(. But it is weird why sorting exceeding 1 sec time limit for 10^5 size array?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

So many failed submissions for C kek

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I lost 1 hour to implement DFS in java for B but I got TLE on case 9... Anyone know why? https://pastebin.com/B42rBZgQ

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +56 Проголосовать: не нравится

380 accepted solutions for D, 135 — for C. This summarizes pretty everything about C.

PS changed epsilon from 10^(-9) to 10^(-12): WA->OK. Nice

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I thought the contest went well... I changed my mind...

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Any clue what case 24 is for Problem C ?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

All solutions for G has failed :(

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

What is intended solution for G? Where are big pretests?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +25 Проголосовать: не нравится

Wake me up, when markysha's submission testing ends

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +111 Проголосовать: не нравится

Oh nice!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

What was the most elegant solution to B supposed to be?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Solved it with DP.
    Code here.
    dp[i][j][k][l] is true if we can reach destination being at i-th row and j-th column, after turning k times and moving vertical (l = 1) or horizontal (l = 0).

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится -70 Проголосовать: не нравится

    I think that you should almost everytime fill edges with '*', for simplier solution and use several queues, or struct :) Use Dynamic array, to save best known solution, for some direction.

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    	int N, M;
    	cin >> N >> M;
    	char A[N + 2][M + 2];
    	int D[N + 2][M + 2][4];
    	pair<int, int>dir[4];
    	dir[0] = make_pair(0, 1);
    	dir[1] = make_pair(0, -1);
    	dir[2] = make_pair(1, 0);
    	dir[3] = make_pair(-1, 0);
    	int sX;
    	int sY;
    	int fX;
    	int fY;
    	for (int i = 0; i <= N + 1; i++)
    	{
    		for (int j = 0; j <= M + 1; j++)
    		{
    			A[i][j] = '*';
    			D[i][j][0] = 3;
    			D[i][j][1] = 3;
    			D[i][j][2] = 3;
    			D[i][j][3] = 3;
    		}
    	}
    	for (int i = 1; i <= N; i++)
    	{
    		for (int j = 1; j <= M; j++)
    		{
    			cin >> A[i][j];
    			if (A[i][j] == 'S')
    			{
    				sX = i;
    				sY = j;
    			}
    			if (A[i][j] == 'T')
    			{
    				fX = i;
    				fY = j;
    			}
    		}
    	}
    	D[sX][sY][0] = 0;
    	D[sX][sY][1] = 0;
    	D[sX][sY][2] = 0;
    	D[sX][sY][3] = 0;
    	queue<int>x;
    	queue<int>y;
    	queue<int>k;
    	for (int i = 0; i < 4; i++)
    	{
    		x.push(sX);
    		y.push(sY);
    		k.push(i);
    	}
    	while (!x.empty())
    	{
    		int a = x.front();
    		int b = y.front();
    		int c = k.front();
    		x.pop();
    		y.pop();
    		k.pop();
    		for (int i = 0; i < 4; i++)
    		{
    			int price = 1;
    			if (c == i)
    				price = 0;
    			int aa = a + dir[i].first;
    			int bb = b + dir[i].second;
    			if (A[aa][bb] != '*' and D[a][b][c] + price < D[aa][bb][i])
    			{
    				D[aa][bb][i] = D[a][b][c] + price;
    				x.push(aa);
    				y.push(bb);
    				k.push(i);
    			}
    		}
    	}
    	int X = min(D[fX][fY][0], min(D[fX][fY][1], min(D[fX][fY][2], D[fX][fY][3])));
    	if (X <= 2)
    		cout << "YES\n";
    	else
    		cout << "NO\n";
    	return 0;
    }
    
  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    My TripleGunShot ;) 26616550

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Many Thanks to You all, got it now

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +48 Проголосовать: не нравится

On C, there is more "Wrong answer on system test" than "Accepted", right? How do we know actually which one is correct, then? :P

And yeah, this round is a very big disadvantage for those who attempt C first. Not a very good round IMHO

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why my solution is wrong for B?!

https://ideone.com/EmkO4J

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится
»
9 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

In problem D, it says ->

The i-th of these lines contains three integers ui, vi and ci (1 ≤ ui, vi ≤ n, 1 ≤ ci ≤ 1000), denoting the crossroads connected by the i-th road and its difficulty.

which clearly misleads to undirected graph, whole time I was solving for undirected graph, removed one line after the contest and its accepted.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

Are the memory limits for B correct, because my submission: 26625940 uses 291044 KB of memory which seems greater than 256 megabytes but yet it still passes, is this right?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +23 Проголосовать: не нравится

    To further elaborate why I am not terribly pleased by this, I submitted this Java solution, and saw that on the pretests, although it passed pretests, it already exceeded 256 megabytes of memory, I forget exactly but it was 280,000 KB or so. Thus I rewrote my solution in C++ and resubmitted. Now after contest I find out that my Java solution passes despite seemingly having a memory issue :( Is there some explanation / way to know in future what the actual memory limit is?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Is G solvable by simple recurrence? It's obvious that we want to model some flow network and run Dinic on it, but is this idea good?

We have some recursive function to model flow-vertices for a given rectangle area. If it contains any corners of forbidden rectangles (there are only 4q corners) then let's divide it somehow and solve by recurrence. If it doesn't, then there is exactly one rectangle made of not blocked cells. Is it enough?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How can we prove that a O(n^4 * m) solution for D doesn't give TLE?

BTW, this "brute force with DP" is much easier than the problem C.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone point out the mistake in this submission for today's B problem Igor and his way to work ?

It fails on pretest 9

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +18 Проголосовать: не нравится

Problem C

WA on Test 40: sadness [ #define eps 1e-9 ]

Accepted: madness [ #define eps 1e-15 ]

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

После этого контеста думаю у многих останутся плохие воспоминания о "Тинькоффе". А жаль, могли ведь сделать лучше.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I have two big idea bugs in E and it still passes

  • »
    »
    9 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +10 Проголосовать: не нравится

    To elaborate

    1) I thought that each of vertices a and b may get in any place in its subtree (but it actually can't for example if there's big subtree on path from root to it)

    2) Instead of checking that number of leaves in subtrees is less than half of all leaves, I checked that it's less than number of all vertices (which is probably always true)

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +106 Проголосовать: не нравится

На контесте, увы, не получилось сдать задачу F за квадрат. Но я-то знаю, что 10^10 должно проходить в 2 секунды =)

Собственно, вот решение за O(N2) в 1.6 секунды.

Если в кратце, то вот такой вот забавный тернарник:

 a[j] = (a[j] >= x ? i : a[j]);

вместо if'а:

 if (a[j] >= x) a[j] = i;

меняет вердикт ТЛ на AC =)

  • »
    »
    9 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +59 Проголосовать: не нравится

    Забыл про еще одну магическую строчку:

    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
    

    С ней 600 мс.

    Справедливости ради, на весьма примитивном тесте, где каждая нитка — это пара i, i + 1 мое решение работает больше 2-х секунд. Странно, что авторы не добавили такой тест.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

That moment when you read problem B, skip it and read problem C and realise, that its too late to skip this contest coz you already attempted A :/

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This may sound very weird

But for question B ,my code gives the correct output 'NO' for the second pretest on my terminal But,it is giving 'YES' when submitted. I am not being able to figure this out.Help will be much appreciated.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This may sound very weird

But for question B ,my code gives the correct output 'NO' for the second pretest on my terminal But ,its giving 'YES' when submitted.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This may sound very weird

But for question B ,my code gives the correct output 'NO' for the second pretest on my terminal But ,its giving 'YES' when submitted.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there anyone who have done problem B using bfs and not getting memory limit exceeding

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone give test case #31 for problem B? I don't know why is my solution giving WA for that case, because it seems flawless to me. Could someone point out the error? 26618834

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    Shouldn't the last dimension of visited be 3 instead of two (since turnsdid can be 0, 1, or 2)? Also, I don't think you need this dimension at all; getting to a given (row, column, dircection) in more moves is not useful, so you can just index visited by (row, column, direction).

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +10 Проголосовать: не нравится

Can someone help me? I submited problem C during contest and it passed pretests, but it got WA in test 40. However when I try the test in custom invocation it gets the correct output.

I am really confuse about this. Thanks in advance ;D

26623849

UPD: Solved, too big EPS. Thanks!

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Можно побольше инфы про экскурсию?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +154 Проголосовать: не нравится

Guys, why are you downvoting this post and the editorial? I've noticed that the rating of this post decreased from ~200 to 50 during last several hours.

My personal opinion is that it was a nice contest. It featured:

  • Two easy problems A and B. Maybe B was a bit harder than usual, but still it was good.
  • A great problem C. I think that ability to estimate the required epsilon is good for a competitive programmer. If you feel unsure about epsilons, you may always write an integral solution, you only had to implement rational number comparison.
  • A beautiful problem D: interesting DP that requires some thinking.
  • Three hard problems E, F and G, all of them were really interesting to solve.

My personal complaint in an editorial post was that in problem G it is hard to prove that any flow-based solution should fit into TL, but KAN convinced me that certain class of solutions should work by mentioning a strong Karzanoff theorem, so the only issues I may possibly see in the contest doesn't actually exist (not even mentioning that this issue affects a really small number of coders).

So, even though my performance on this contest was not really good, I think that authors did a great job and that we should support them, not downvote because your solution failed due to epsilons. Consider this as a good lesson, not as a disadvantage of the problemset. What do you think?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +38 Проголосовать: не нравится

    I agree that E is cool (bad tests aside), I didn't have time to think on F and G, so can't say much about them, but great problem C, seriously?

    • »
      »
      »
      9 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +22 Проголосовать: не нравится

      I'm completely serious. It may have some defects in the statement like the fact we have to find a minimum in an open set, but I don't see why it is bad at all.

      • »
        »
        »
        »
        9 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +16 Проголосовать: не нравится

        It's not CF format I think. Maybe they should've added the anti-epsilon test in pretests, it would be better than many failed solutions.

        • »
          »
          »
          »
          »
          9 лет назад, скрыть # ^ |
          Rev. 2  
          Проголосовать: нравится -9 Проголосовать: не нравится

          The fact that the smallest possible non-zero difference of two rationals with denominator of magnitude A has a magnitude of ~? Yeah, that's not a fact for CF round, that's a fact from basic algebra course. Or should the authors always choose the constraints in such way that eps = 10 - 9 works?

          I really don't see what's the issue here. You estimate the complexity of your solution by multiplying some numbers from constraints, estimating the epsilon is basically the same. Then why did you fail to do the same here?

          • »
            »
            »
            »
            »
            »
            9 лет назад, скрыть # ^ |
            Rev. 2  
            Проголосовать: нравится +68 Проголосовать: не нравится

            Personally I failed because haven't even thought there can be such issue in div1A, so just used standard epsilon thinking "fuuu, another non-interesting geometry problem". If I had thought about epsilon, I would've chosen the correct one of course, but I simply didn't expect this and it was my fault, but I still think this problem is just waste of someone's time and nerves.

      • »
        »
        »
        »
        9 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +83 Проголосовать: не нравится

        Well, I may be too choosy but as for me it was not interesting at all, just bunch of cases to check.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Is it possible to solve B without using a second 2d array for the grid ?

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

For problem B, I got WA on test 62. Here is my submission: 26615111

Can anybody help me ? What's wrong in my code ?

Update: I have found my bug. I was using visited array as vis[row][col][mov], using visvis[row][col][dir][mov] got AC. here is my AC code: 26632674

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

My accepted solution for C uses doubles and doesn't have an epsilon; did I just get lucky? http://codeforces.me/contest/793/submission/26615231

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +62 Проголосовать: не нравится

А че у всех бомбит-то? Не умеете с даблами работать? Нормальный же раунд. Не идеальный конечно, но и далеко не худший, бывало и хуже

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    Согласен. Например, прошлый контест (VK Cup Round 2) вообще был учебником по математике. Я считаю, что он был гораздо хуже этого. Тут хотя бы как-то связан раунд с программированием. Хотя, думаю, у многих бомбит от задачи B. По мне, так она вполне себе тупая и на уровень B тянет.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

Гайс, я раунд не писал, но че не так то? Вы хотите эпсилоны подгонять на контесте с постпроверкой?

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +358 Проголосовать: не нравится

To be honest, I was completely shocked when I opened Codeforces today. Shocked and really, really disappointed, as for the first time in Codeforces life I saw a round post having a negative rating. The round had no bugs in validators or model solutions, no serious statement issues, no problems spoiled on the other judges and even no technical troubles. It only featured a signle problem that asked participants "Oh please, dear sir, would you be so kind to turn your brain on and try to figure out what the correct value of epsilon is?"

I think this is a very serious moment for us to stop and look close at our competitive programming community. I always used to be proud of being its part, but this time I feel shame.

I've prepared many contests, but I still experience inspiration and joy every time I prepare and conduct them. And I wish I can again feel how it feels for the very first time you see thousands of people submitting the problems you've been preparing tests for during the whole last week. The fact the authors got downvoted that much is so humiliating and insane it can't fit in my mind.

Dear Codeforces community, for god's sake I ask you to fix it immediately and let's just pretend this never happened.

  • »
    »
    9 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +154 Проголосовать: не нравится

    The round was delayed -- but well, it didn't affect anyone during the round. However, you lie saying that there were no technical issues, but well again, no technical issues during the contest.

    The main two problems are the following ones:

    1) EF problems had weak systests. Read the comments. One guy passes E with two bugs (actually one of them is not a bug itself but makes the problem wider), and another one passes F for 10^{10} (in the upsolving, though, but this doesn't make the contest better).

    2) The round isn't actually about thinking but about a careful hand jo^Wwork. Someone may think it's good for a CF round (and, erm, even claim that it's better than vkcup round 2 problemset), but let these ~5-10 percents of community say whatever they want.

    As you see, the third problem is indeed not the main disadvantage of this round, it's just a cause of div2 butthurt. And, well, all checkers and validators are ok, all statements are fine, but without good tests the contest is objectively not very good.

    Returning to the main point of your comment, I agree that authors made well enough to deserve positive post rating. I think each participant to get his piece of satisfaction and/or lesson. But please don't call the contest nice just because of absence of things which actually must not ever take place.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +86 Проголосовать: не нравится

    First off, I have a lot of respect for you and for everything you've done for Codeforces.

    However, what is the point of allowing upvotes and downvotes if whenever the results don't go your way, you ask for the community to fix it? We're all used to high quality problems on this platform, and downvoting is the only way to provide feedback when we feel the problems aren't enjoyable/interesting. I agree that negative rating is overboard, but maybe we can all have better contests in the future if Codeforces learns something from us too.

    • »
      »
      »
      9 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +15 Проголосовать: не нравится

      Starting from January I'm no longer a member of Codeforces team, so the text above is no more than my personal opinion. I agree, that upvoting system is a very important quality control tool, just expressed my opinion that the tool got broken this time.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Так может это просто боты заминусовали.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

downvotes > upvotes => it shouldn't have been this contest at all :'( sad
luckily I didn't read C statement after I saw test case :|
B and G were very interesting

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

В задаче F очень слабые тесты. Моё простое решение(которое работает в худшем случае за ) залетело за 327 мс. Сразу же нашелся контртест, который валит мое решение.

n = 1e5;
m = n - 1
1 2
2 3
3 4
...
(n - 1) n
q = 1e5;
1 1
1 2
1 3
...
1 n
»
9 лет назад, скрыть # |
 
Проголосовать: нравится +144 Проголосовать: не нравится

Regarding the problem C.

At first, I want to say that there is my fault that I haven't noticed the precision issue in this problem. In fact, authors' solution (to move the rectangle bounds by ε) worked with any ε from 10 - 6 to 10 - 15, so I thought this was ok.

Secondly, most of numbers we encounter in real life are real numbers, so we should be able to work and solve problems with them. And of course the knowledge about how computers work with floating-point numbers and the ability to estimate precision are not useless skills. That's why such problems have a right to appear on contests.

To summarize, I want to apologize to those affected by the precision problem. If I was preparing this problem again, I would give stronger pretests and/or smaller the constraints. However, I don't see any reason to not give this problem at all.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +49 Проголосовать: не нравится

    Well this problem is not suitable at all for a CF round. Man you have 2 hours only and 7 problems which I believe were hard. It is not reasonable to make your testcases that strict so you waste like 15-20 minutes of a lot of contestants time who will write the code very carefully. I mean at least you should make the pretests strong so like 80-90% of people who passes gets ac after the end of the contest.

    It will make a good one for a 5 hour ACM-Style contest. I believe I am not the only one who skipped the round because of this problem.

    • »
      »
      »
      9 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +56 Проголосовать: не нравится

      Why do people spend their time only thinking about how to come up with asymptotically fast and correct solution? Don't you need to think about how to implement solution so that it doesn't take several hours?

      The idea for this problem Let's solve the problem for X-coordinates and for Y-coordinates independently, and then intersect time intervals gives great advantage in implementing. Plus, this way of thinking makes you think about other edge cases, where move-coordinates are equal to zero, and it's easier to handle them.

      I didn't come up with it during the contest, so I couldn't get my solution accepted.

      Many say that this is bad problem, because it doesn't require any idea. But I think, it's good, when there is an idea, which gives you a huge advantage during implementing. And contestant can choose for himself: either he wants to implement the first idea he has in his mind, or think to make his life easier.

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +71 Проголосовать: не нравится

    This is an adequate answer, but still nothing about weak tests in E and F. Problem E has only 44 tests, being a YES/NO problem with non-trivial operations in implementation, which can lead to finding wrong solution instead of correct one, and this is the case not caught by YES/NO answer. So in this problem it's definitely necessary to write REALLY A LOT of incorrect solutions, which consider some steps of the algorithm incorrectly or simply have some implementation bug. If these things had been done as well as the tests against each such solution, there would have been way more tests in this problem.

    And F is just another case with stupid optimized solution receiving OK. There was simply no test making this solution to do maximum number of operations, which is maybe musthave in any queries problem.

    Both these cases are good lessons, so hope CF to avoid them in future.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone please help me understand why I am getting WA on problem B on test case number 62?

What I basically do is the following:

1) all cells reachable from the S cell are marked with 1.

2) all cells reachable (and not visited already) from any cell marked with 1 is marked with 2

3) all cells reachable (and not visited already) from any cell marked with 2 is marked with 3

If the cell containing the bank is marked with a number different from 0 then the instance has a solution. It's basically a BFS.

code's here

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -113 Проголосовать: не нравится

Раунд интересный, необычный, но это же Tincoff challenge — то есть не очередной контест, а немного другие задания и формат соревнования. И странные, необычные задачи, а также слабые претесты возникают из-за другого формата, непохожего на стандартные соревнования, поэтому любое сравнение со стандартными раундами — не совсем корректно

»
9 лет назад, скрыть # |
 
Проголосовать: нравится -23 Проголосовать: не нравится

Well, problem C was not that bad to me though I am still getting WA. But observing the huge amount of WA in system tests after contests makes me think that, maybe, just maybe, there is someone in North Korea who is preparing to go to the Labor Camp, because Kim Jong Un was expecting him to become Red in this contest and he failed because of this problem :p

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My Rust solution gets runtime error on the sample, even though it runs fine on my machine. Any idea as to what's going on?