Блог пользователя niyaznigmatul

Автор niyaznigmatul, 8 лет назад, По-русски

Разбор задач

Всем привет!

Codeforces Round 467 (Div. 1) и Codeforces Round 467 (Div. 2) пройдут в воскресенье 25 февраля в 17:35 по московскому времени. Раунды основаны на задачах Олимпиады Университета Иннополис для школьников по информатике, но совпадают с ней не полностью. Просим участников олимпиады воздержаться от участия в раундах и обсуждения задач до конца раунда.

Задачи подготовили: niyaznigmatul, pashka, vintage_Vlad_Makeev, VArtem, burakov28, budalnik, YakutovDmitriy, dusja.ds, GreenGrape, tourist. За прорешивание и вычитывание спасибо demon1999, craborac, the_art_of_war, qrort, .31, izban и julsa.

Удачи!

UPD: Раунд пришлось подвинуть на 1.5 часа вперед, чтобы избежать пересечения с квалификационным этапом VK Cup 2018.

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

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

Hope the problem statements are as short as the announcement!! :D

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

There are some users who regestered in div.2 round before the rating change of round 466 and now they are div.1

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

Почему бы не сделать раунд во время олимпиады?

Тогда и возможность нечестного участия тех, кто уже видел задачи, была бы исключена.

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

This round will be held in usual time. It's good for someone.

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

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

It's the first time ever I've seen a contest with 10 distinct writers :O

Let's hope for a quality contest with no interference from DDoS and server issues ;)

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

Round# 467 is a prime number while contest(div. 2) 937 is a prime number, too!

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

I have found the name tourist in the problem setter section :D

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

10 problem setters , sir tourist is also here , i think this contest problems are too much perfect and malleable , too much excited :)

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

Hopefully the number of problems is less than 10 considering there are 10 problem setters xD

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

My brain singing "I want something just like this" :p

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

How many problems are expected? There are many setters

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

So is contest starting at 16:05 UTC now?

Edit: I realised later I can see the time in Contests tab.

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

Hope a round whose time is good for East Asia users!!!

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

Please make this round visible in a "Pay attention" section (can't see it in RU version) and include it into the list of upcoming events! I found this round only accidentally.

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

tourist as setter in Contest #2 of 2018 (Contest #1 — Hello 2018).

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

It is not good to change the timings at the last moment as all my plans are getting disturbed.

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

labib attacked by chikunguniya :D please pray for him ;)

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

So sad it delayed.It is 12:05 UTC+8 now :( I know I'm not that good at programing,but I just want to join in the contest for fun... (Unhappy Chinese pupil)

BTW,will my comment be hidden because too negative feedback?

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

The comment is hidden because of too negative feedback, click here to view it

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

中国迎来了帝制,我无比的伤心。

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

Why the delay...? I want to know what those "other events" are?

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

so what about score distribution?

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

Got up early on a Sunday morning for a contest and found it delayed like.

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

I can't participate in this contest because it delayed. But I have registered. So the question is: will my rating be influenced if I don't participate. If yes, what should I do?

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

А что, вчера не было известно, что с квалификацией пересечется?

UPD Письма тоже не было. Очень некрасиво так делать, пишите тогда прямо причину — думали, что можно два контеста одновременно проводить, оказалось — нельзя.

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

I know the event today.

it's VK Cup 2018,not tourist's marriage.:-)

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

Although I was very busy at work but came home earlier for the round, and see that the scheduled time is changed. For next rounds, I suggest to change date or time at least a day before the round.

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

Events like Chelsea VS Manchester United :)

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

I'm too worried about codeforces server errors during the contest. Let's that it'll not happen again.

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

please post the new score distribution.

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

Hate the time delaying. The new time conflict with my sleeping time

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

I hope this contest will make me green !.. I just need +75 rating to become a green coder...

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

Исправьте

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

Hopefully it will be a cool contest.

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

I hope, systesting of VK cup will be turn off during the round.

UPD: So you haven't done this...

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

I think all of you guys should stop arguing. Codeforces is a programming website, not a quarrelling website!

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

Came here to read funny comments but man wtf?!

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

to CF Server : DON'T FREEZE.

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

From my school years I remember this olympiad as a trash. Seems like not much have changed. No offence.

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

Unrated Round cy >(

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

fucking long queue!

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

What is this? There is 10 pages long queue. (~700 submissions only in div2)
Make this round unrated >.>

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

Today's day is so good : I am performing wonderful in the contest and queue is helping me in it :)

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

what is this? This much Queue

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

goodness me there is a 10 page+ long queue. Please fix it asap!

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

13 page long queue ! what is this !

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

You know the queue is so long when you're in Div.1 and the "In queue" verdicts' region is wider than a 50-line page...

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

Shit man! I really hope the round won't be unrated because of the long queue.

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

It's taking a very long time to process submissions...

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

The judge is running too slow . so frustrating at times .. look into it

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

Tomorrow is my Exam but still i'm giving the contest to get away from the stress situation but these long queues of codeforces are giving me more headache than my syllabus did.

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

Are DIV 2 Contests getting harder or I'm the one who is getting dumber ??

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

What the hell is pretest 10 in C?

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

how to solve DIV2 : B?

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

How to solve Div-1 C?

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

    First turn the string into a permutation, that we want to transform into 1,2,...,n. Then, starting from n/2, start constructing the string. In a single step, do: 6789...5... --> ...6789...5 --> 5......6789 --> 98765...... This reverses the string we've built, and adds the number we wanted to add to the end of the reversed string. Use this to append small and large numbers alternatingly. It takes 3*n = 6000 operations.

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

    I had similar idea to other one.But I wanted to share my way of thinking.I could easily come up with 4*n steps for building from one corner to another. But the 4*n was coming because each time the string was coming reversed so that wasted n steps to straighten in it. So doing from middle and adding a letter on each side we can get rid of straightening here.

    4*n approach: assume u have come to this form S.... S is suffix of required string . Now I will describe a method to convert it to Y.... where Y is bigger suffix by 1 than S. So now we find character before S in t and flip it there so now ....Y... we have.Now we have to bring Y to start for that we reverse whole string(...rev(Y)...) and bring rev(Y) to end (....rev(Y)) and now flip from just before Y giving Y..... . So main idea is getting rid of reverse whole string by doing operations from both sides.

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

      I extend the prefix like you do in your 4N approach, but each time I add a letter from a different end considering that s[0] and s[n-1] are adjacents. At the end the string may need to be reversed and/or rotated. Reversing it is simple: op(n). Then if it needs to be rotated X times, you can do that with 3 operations: op(x), op(n-x), op(n).

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

Problem E is fucking awesome (no sarcasm)

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

Again a good problemset... Thanks codeforces.

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

What is hack test for Div.2 D???

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

What were the hacks for B?

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

May anyone tell me the core issue to raise a TLE in pretest 4 of Div1B/Div2D? ;)

Here is my last solution, sorry for the code being so messy...

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

    Maybe you didn't judge the condition when there is at least one circle in the graph,but there don't exist anyway to get to a point with a 0 outdegree,then in this case he could at least draw?

    I didn't pass all the pretests until the end of the contest(it may be something wrong with the output of the path),but I failed on pretest 4 previously,and after I found this condition and judged it I passed pretest 4...

    Hope it can help you,and sorry for my bad English

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

      Well, seemed like I got the issues. I did check for such, but I was totally careless when handling my condition-checker in return commaands.

      Not sure if it could save me from TLE-ing, but at least it was wrong.

      Thanks ;)

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

MATH, MATH, everywhere MATH.

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

Hack for D div 2:

5 5
1 2
2 3 5
1 4
1 2
0
1

Expected :

Win
1 2 3 4 2 5 
»
8 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится
»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please explain the logic for solving Div2.D/Div1.B ?

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

    You need to reach a childless node in an odd number of steps to Win. You can track the parents of all nodes that can be visited starting from s in an odd and even number of steps and their in a 2*n array.

    If one childless node can be visited in an odd number of steps, you win. Else, you draw if there is a cycle attainable from s. Otherwise, you lose.

    Edit : my condition for cycle detection was wrong. You have to check explicitely for cycles starting from s to differentiate draw from loss

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

Could anyone give any hint to solve div2 D?? Thanx in advance!!

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

If you pass pretests on a submission and then get compilation error on the next, does the accepted solution go through system testing or does cf take the last submission even if it gives WA/compilation error?

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

In div-2 D, when I tried to hack and got unsuccessful attempt, I realize I misunderstood...

I thought the real Vasya starts after some point, So for have a draw, in every possibility they cannot get out of the loop .

3 3

1 2

2 1 3

0

1

my answer is Lose for it although the real answer is Draw :(

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

Another hack for B. Although i din solve D, as i found the test case in which it will fail 35 min before the end and i could not find the solution, this is it. 8 8 1 2 1 3 2 4 6 1 5 1 1 1 7 1 8 0 4 ans is win and 4 5 1 2 3 6 7 8

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

Спасибо за интересный раунд, надеюсь на + к рейтингу

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

For div2d ..

if: find any path to a leaf and it's vasya's turn --> win

else if: cycle --> draw

else: --> lose

What's wrong ?

Edit: never mind. My code contained a bug

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

How people could solve problem C in 1 minute? Like LoDThe.

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

in D div 2, assuming both petya and vasya play optimally well right?

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

In problem D : my codes second one is correct :( :(

Unable to parse markup [type=CF_TEX]

https://www.diffchecker.com/FXKB7hnM

UPD : second one also wrong ! :))

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

long queue but nice round, hope rated!

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

4 4 2 2 3 1 4 1 4 0 1 hack for div2 D: ans is lose

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

Can anybody tell me what is the time complexity of this code for DIV2 B.

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

Late hack announcement! Little too late!!!

I submitted Div1B in 01:22:38 and it was hacked in 01:31:59. Room

But I didn't get any hack announcement notification during the contest time. I checked my submission couple of times in Room standings and Common standings but didn't see that it had been hacked. Even, I refreshed the main Problems page and standings page after the contest had ended, till then it was in "pretests passed" state instead of "hacked". I only got a hacked notification during the system testing. I didn't take any screenshots for proof as now I think I should have (sorry). Now I am thinking, how much a late hack announcement/update can affect a contestant? Also had anyone else experienced this?

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

    My Div1B was also hacked without giving me a pop-up notification whereas it should be given immediately right after a submission is hacked in normal practice.

    Luckily, in my case the verdict showed correctly with "hacked" in "My submission" page. As a result, I was not affected by the missing of the pop-up notification after all.

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

Poland stronk!

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

Ooops! Something has broken down in Codeforces :<

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

In Div2 problem C: what is the correct output for this test case: 999999999999999999 999999999999999998 1000000000000000000

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

How did LoDThe solved div2A at 00:02:12 and div2C at 00:03:38 in div2?

No one in the top20 positions in div1 solved div2C in under 4 minutes, and he even solved A before!

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

D went from ~400 ACs to ~70. E F F C Y C L E S

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

I got WA for problem DIV2 D on test 28 which was:
Participant's output
Win
233 971 277 477 871 502 673 37 219
Jury's answer
Win
233 864 714 151 370 604 141 233 971 277 477 871 502 673 37 219

what was wrong ?

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

Why am I getting the wrong answer for div2B. I used the segmented sieve and I am getting the correct answer when I run it on my pc.Here is the code..

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

Testcases for E are too many..

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

Currently, Div.1 contest doesn't have a final result yet, because of this.

If molamola.'s solution for Div1E is correct, he/she will make it to the 3rd place. Cheers! ;)

UPD: Accepted. Congrats!

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

В div2 минут 10 как дорешивание открылось, а в div1 всё еще проверяется одна единственная посылка по Е... хорошо, наверное, что только одна)

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

i got wrong answer in C-Div2 because the output number was in double format like that 7.67538e+017 insted of 767537647587662141 , so is that my fault or the judge fault

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

Running the same code on the computer gives different results from that when it's run from the judge! Link

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

Rating changes take forever when you want them to be quick.

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

Yes.

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

Can somebody please tell me why my code for D gets a TLE at pretest 4? Link- http://mirror.codeforces.com/contest/937/submission/35711753

For some reason, the DFS function is running into an infinite loop- but according to me that shouldn't be, as I am using the recur[u] to act like visited[u] in a way. I used the fact that, the only way when recur[u] will be 0 again after becoming 1 is when the DFS of the subtree of u ends- else its a cycle which we detect and exit such visited nodes.

Any test case or help is appreciated. Thank you :)

(I know this can Time out for larger cases, like, vertex s leading to n/2 nodes, and all those n/2 nodes leading down to same chain of length n/2. Like a long-tailed kite. But why is it getting TLE at pretest 4 with n=50 is bugging me :( )

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

Hi guys, while you are waiting for editorial, I'll try to help you to solve problem D.

So, our task is to find a uneven route to a leaf-vertex (a vertex that has no edges coming from it)

The answer is Draw, if the graph doesn't contain leaves at all.

If the graph has a leaf (leaves). But a route to each is only even, we need to check whether the graph has a cycle. If it does — the answer is Draw else the answer is Lose.

If the graph has a leaf with an odd route to it the answer is Win.

Now our task is to output the way to our leaf. We should be careful with it and not break a while(probably :P) cycle if our route at the moment is even!

How can we code the written above? I think, that one of the easiest way is to write a bfs and check the following:

"If we can reach a V-vertex with an uneven route then we can reach TO-vertex with an even route. And vice a verse"

My solution is here. Feel free to ask me some questions. GLHF

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

Too eager to know solution for Div2 E/ Div1 C.. help required

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

I am seeing some pretty complicated submissions for problem B — Vile Grasshoppers.

The main idea is that the distance between consecutive primes upto 10^9 is never more than 300 or so. This allows us to start from y and keep decrementing, till we get a number who's smallest factor is greater than P. Worst case, we will not have to do more than 300 root(n) factorisations.

Explanation and code.

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

Lost ~1300 points because I didn't use std::fixed in the output of Div2/C...

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

Can anyone tell me why my solution is failing at test 28?

http://mirror.codeforces.com/contest/936/submission/35722758

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

    Cause in your solution you do not consider paths like 1->2->3->1->4->5 when you can return to previously passed vertex and still win, I guess so.

    Check this out:

    5 5

    2 2 4

    1 3

    1 1

    1 5

    0

    1

    If it returns "Draw", your solution is wrong.

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

Тем, кто участвовал в Бишкеке результаты олимпиады не сказали. Они есть вообще где-нибудь?

P.S.: футболки и прочие приблуды до Бишкека тоже не доехали. Вот печаль-беда =(

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

    Результаты

    Вроде и не должны были доехать. Площадки соревнований создаются для удобства участников, как минимум чтобы им не приходилось искать большое финансирование на поездку. К сожалению, кроме отправки приблуд есть ещё много организационных проблем. Приезжайте на основную точку проведения финала :)

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

When can we expect editorials ?

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

Hey in the C problem of div. 2 one of my friend's code got accepted and as I was going through the test cases I found this(refer link). How is this possible? https://drive.google.com/open?id=1scjEnYJuRpkfcu2gPGvJRpBm94NcH1sH

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

How to solve Div2 C?

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

    Our goal is to find how long will be a chicken in a fast mode and in slow :D.

    So, in first k minutes chicken will be prepared for ((k/t)*100)%.

    fastMode=((k/t)*100)

    Now we need to find a moment of time when Julia will again switch chicken to fast mode. This moment will be f:

    f=ceil(k/d)*d => (f-k) minutes chicken will be in a slow mode and will be prepared for ((f-k)/(2*t)*100) %.

    slowMode=((f-k)/(2*t)*100);

    So total time of that cycle is k+(f-k). After each cycle our chicken will be ready for fastMode+slowMode%.

    Now let's find out how many full cycles we will be able to "put" in our 100%. That is floor(100/(fastMode+slowMode))

    At that moment our answer=floor(100/(fastMode+slowMode))*f

    Finally we need to check how many percent of chicken preparation left left=100-floor(100/(fastMode+slowMode))*(fastMode+slowMode). If it is equal less than (k/t)*100 then we just add to our answer (left/(fastMode))*k, else ans+=k, left-=fastMode and then ans+=(left/(slowMode))*(f-k)

    Yeah, I see it looks quite complicated , but you are free to ask questions. Maybe my solution could also help.

    ** P.S. When I was using % (multiplying by 100) i received a WA on test case #32. On codeforces compiler answer was "nan" while on mine it was OK :( **

    UPD Corrected a formula

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

      If d > k then your algorithm will give f = 1 => f-k = 1-k(negative for k > 1) minutes chicken will be in slow mode. Isn't it undesirable? BTW thanx for great explanation.

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

      This solution is correct but the formulas can be simpler:

      Indeed, the chicken is cooked in fast mode for k minutes then, for d — k mod d minutes. Indeed, after k + (d — k mod d) minutes, you will be on a multiple of d. So the lenght of a cycle is of k + d — k % d. The formula for the number of cycles : cycles = t / (k + (d — k%d)/2)

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

      When I ran your code for k = 2, d = 5 and t = 10 it outputs 14 whereas the answer should be 12, shouldn't it? or am I missing something?

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

        The correct answer is 14.

        After first cycle: chicken is prepared for 4/20+3/20=7/20; TimeTaken=5;

        Second cycle: chicken is prepared for 14/20. TimeTaken=10;

        Third cycle onlyFastMode: chicken is prepared for 18/20. TimeTaken=12;

        We need to prepared chicken for 2/20, while using fullSlowMode we will prepare it for 21/20. That's why we need to use only 2/3 of our SlowMode. So the time of this part of SlowMode will be 2/3*3=2.

        TimeTaken=12+2=14

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

Editorial?

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

17 people contributed to this contest and there is no editorial after one day!!

UPD1 : a semi editorial is posted,hope to see the complete one!

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

Why 35710602 WA ? Div2D

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

    Your problem is that you overlooked the case when you have a cycle with odd number of vertices where you should transverse the cycle to change the turn from Petya to Vasya and vice versa.

    Consider the following testcase:

    5 4
    2 2 4
    1 3
    1 1
    1 5
    0
    1
    

    This corresponds to a graph that has a cycle 1->2->3->1 but it still had an answer 1->2->3->1->4->5 Your Code gives a wrong answer in that case as it prints "Draw" instead, you just didn't handle the cycles with odd number of vertices case.

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

i was waiting for editorial but after a day now i decide to ask my question here...

how to solve Div2.D(Div1.B)?

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

where's the tutorial to the problems ?

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

pls, upload the editorials...

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

niyaznigmatul Div. 1 E doesn't appear to be viewable.