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


Привет, Codeforces!

Сегодня в 17:15 по московскому времени состоится финальный раунд чемпионата КРОК 2016, в котором 50 лучших участников отборочного раунда будут соревноваться за ценные призы, а также просто ради удовольствия. Призы лучшим в Финале:

  • 1 место — 100000 рублей
  • 2 местo — 70000 рублей
  • 3 местo — 50000 рублей

А победителем игрового тура стал Belonogov, который был награжден призовым фондом 50000 рублей! Поздравляем!

Для всех остальных завтра в 19:35 по московскому времени будет проведен Codeforces Round #347 на почти идентичном наборе задач. Это будет обычный нерейтинговый раунд, отдельный для каждого дивизиона.

Задачи для вас подготовили Евгений Вихров (gen), координатор всея Codeforces Глеб Евстропов (GlebsHP) и я. Также хотелось бы поблагодорить Михаила Мирзаянова (MikeMirzayanov) и всю команду, работающую над Codeforces, за замечательную платформу, а также Александра Фетисова (AlexFetisov) за прорешивание задач.

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

Надеемся, что вам понравятся наши задачи. Удачи финалистам сегодня и всем остальным завтра!

UPD 1: Ссылка на текущие результаты Финала: http://mirror.codeforces.com/spectator/contest/662/standings

UPD 2: Codeforces Round #347 будет нерейтинговым.

UPD 3: Разбалловка
Div 1: 500 — 1000 — 1500 — 2500 — 2500
Div 2: 500 — 1000 — 1500 — 2000 — 3000

UPD 4: Поздравляем победителей!

Финальный Раунд чемпионата КРОКCodeforces Round #347 (Div 1)Codeforces Round #347 (Div 2)
  1. tourist
  2. vepifanov
  3. riadwaw
  4. PavelKunyavskiy
  5. Merkurev
  1. Petr
  2. ilyakor
  3. step5
  4. Endagorion
  5. gs12117
  1. unused
  2. Pakalns
  3. yao981113
  4. yeguanghao
  5. hzq84621

UPD 5: Разбор задач: http://mirror.codeforces.com/blog/entry/44408

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

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

Finally, a rated round :D

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

best 50 participants from the Qualification Round will be competing

I think you mean Elimination Round..

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

So, perhaps some people will have privilleged information about the problems appearing in the rated round tomorrow, e.g. friends of the 50 people competing today.

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

Финалисты могут рассказать другим о задачах. Вы думали об этом?

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

Won't the problems be harder than usual?

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

Well I have to say that if the problems are going to be almost similar you want to make sure to block everything related to this contest until tomorrow.

If you click in the profiles of any of the contestants you can see the submissions they made for this contest...

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

who is the champion? I cant open the standings page :(

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

"Everyone else will be able to participate in Codeforces Round #347 tomorrow at 19:35 Moscow time that will feature an almost identical problem set. It is going to be a usual rated round, separate for each division." There are something error? I've seen the code of tourist and everyone else, and the problem are the same :)

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

Завтрашний контест отменяется?

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

how to solve D?

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

Saw a funny bug after the rating updates:

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

a link to the position participants not working

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

Cheat...

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

ADMINISTRATORS PLEASE STOP IGNORING. REPLY ANYTHING ABOUT PEOPLE WHO SAW PROBLEMS' CODES
IS THE CONTEST GOING TO BE RATED OR NOT? IF RATED THEN HOW?

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

GOOD JOB Belonogov!!!

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

A rated contest after a while !

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -260 Проголосовать: не нравится
Комментарий удален по причине нарушения правил Codeforces
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +40 Проголосовать: не нравится

I don't see why it was necessary to create a rated round with identical problem set a day after. Unless it's a mirror round in real time I don't see how it would work well — information always leaks.

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

    It seems now we have to do the round unrated. It is really pitty. It was my mistake that I accidentally opened the solutions for 15 minutes. I upset the behavior of some of the participants who did not give opportunities to others to fully take part in the round. I involved in programming contests for 15 years and I'm sure that this community rests on mutual respect and honesty. Yesterday it was impossible for us to run round in the same time or just after the Finals.

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

So there are going to be people in today's contest that already have the solutions for the problems? If today's problem set is identical to yesterday's, then they should probably call it off since there will be people that cheat their way to the top. Kind of unfair, hopefully there's some solution to this.

Edit: Looks like MikeMirzayanov is just going to make it unrated. That sucks, but I guess it's the best solution.

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

I've been waiting for a rated round sooooo long. Huh...oh wait my luck just steped in. U know what gray kinda suits me.

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

not rated :(

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

i think unrated contest is the best solution in this situation because the solutions have been revealed

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

The announcement still says "usual rated round" . Which is it rated or unrated ?

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

Any chance for changing problemset a little bit?

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

Can the problem set of Educational Codeforces round be used? It is going to take place in just a few days.

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

In my case, I will take part on the contest if it is unrated, since being rated makes mee feel unconfortable given the situation. Being rated or not, trying to solve the problems is interesting.

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

Mike , can we please have a final confirmation from your side , that round will be rated or not ??

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

Это будет обычный нерейтинговый раунд

Обычный раунд не может быть нерейтинговым... =(

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

Mike, can we please have a final confirmation from your side whether the round will be rated or not , it will greatly resolve the confusion ...

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

So bad>_<... Can't participate in any rated contest in long time. TAT

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

Codeforces Round #347 will be unrated

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

Got too excited after seeing a rated codeforces round :v But, UPD 2: this round will be unrated :( Have to wait :(

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


And that was the reason why, on 4/16/2016, I decided to quit competitive programming. Good bye CF community!

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

too many unrated rounds recent times :(

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

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

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

"It is going to be a usual unrated round, separate for each division."

Once upon a time rated rounds were usual not unrated ones.....

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

people calm down it isn't that big of a deal. first, tweety did nothing wrong in fact he was making sure the rules weren't violated. second, so a rated round turned unrated so what I'm gray I'm dying for a round and still I'm not bothered by the fact that someone turned it unrated (what would you all do if it was mike who said there were leaks and the round will be unrated???) third, I can't believe that the whole CF community was shaken by such a small mistake.

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

A, B, C was tasks for improve realization) LoL)))

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

And after all this mess tweety did't participate :3 .

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

Спасибо за испорченный раунд. Алсо, почему-то уведомление не дошло, заметил его только на странице задач.

Как решается С?

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

Codeforces should hold more rated contests and soon, as there is clearly a lack of rated contests. We finally a rated contest, and even that becomes unrated. :( Something has to be done about this.

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

All of us might feel bad that we lost a rated contest. I agree with you'll, even I was waiting desperately for a rated contest. However, we need to look at the bigger picture guys/gals. There was a solution leak a day in advance.. this is a major mistake and something should have been done about it earlier itself. Instead, all moderators and codeforces team decided to ignore the mistake and just remain silent and let a contest full of cheaters and wrong solutions take place.

I guess this is very wrong. It almost becomes a matter of luck something like "I saw the solution its my lucky day! let me increase my rating.." Then some guys like Tweety prevented this from happening and made people aware that the soultions are available and have been leaked. They , tired of the silence from codeforces moderators decided to share their codes so that such cheating does not happen. For me , tweety saved me. I prefer a unrated contest than such cheating happening behind ignorance and a wall of silence. Thank You!.

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

    All hail tweety our saviour/ martyr (because some of his upvoted comments were deleted).

    On a more serious note, I totally agree with you. I was going to participate blindly if it wasn't for tweety, and I would've probably lost a lot of my points because I didn't know that the solutions were leaked.

    Let's all remind ourselves that it wasn't tweety who leaked the solutions. He was the one to draw attention to the fact, refusing to stand by while a few individuals took advantage of the situation.

    The organizers might not like him for that, but it is something very common to have a scapegoat around for your screw ups and what better scapegoat than the one who drew attention to their mistakes in the first place.

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

I hope, next really rated round will be soon..

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

My hacks B:

Test: (0-5 ones)3098, Answer: (1-6 ones)3098

Test: (0-5 ones)3099, Answer: (0-5 ones)3099

Test: 099999999, Answer: 1099999999

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

Good test on Rebus:

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

Worse contest ever :( Really worse problems...

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

Why is everyone angry i can't believe that doing the good thing can make u hated a lot Really "no good deed goes unpunished " Tweety did the right thing reporting the cheaters For all we know the ones who are saying ban tweety could be one of the cheaters

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

I think tweety need to do rated contest. Let it be his apologize to the community.

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

Could you publish the onsite results now?

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

The moment I see the word 'unrated', I just want to cry :'(

Why? Why? Why? And why?

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

Haha I solved a totally different problem on B.

Given a list of abbreviations in order, find the smallest year matching each that hasn't been used before.

I didn't get that the queries were independent and only realized the true intent of the problem after an unsuccessful hack. I guess I tried to go too fast this time :)

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

Could anyone share their idea how to solve Div1 E?

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

    Here's a sub-problem:

    you are given at most 200000 "selected" 20-bit numbers. For each possible 20-bit number and each number k, find how many selected 20-bit numbers differ from this number in exactly k bits. This is done using DP.

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

    You can compute freq[x] = number of times the bitmask x appears Also, compute cost[x] = min of (number of 1s, number of 0s).

    You want to compute minimum over all j of the sum freq[j^x] * cost[x] (i.e. we flipped the rows according of to the bitmask of j).

    You can compute sum freq[j^x] * cost[x] for all j in n*2^n time using a variant of fft. (You can see the editorial here: https://www.hackerrank.com/contests/back2school14/challenges/xor-subsequence for code).

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

    An approach slightly different from the one described by Petr (might be easier to come up with, but is much slower): let's iterate over the first 13 bits. If the first 13 bits are fixed, each number becomes pair (distance on the first 13 bits, last 7 bits) — there are only 27·14 such numbers. So, with this we can iterate over the last 7 bits and solve the task with brute force. The number of operations is 213·(100000 + 27·(27·14)), which is small enough.

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

    Obvious but slow solution: fix a mask of rows that we're going to flip. Now, for each column we can achieve min(ones(column[i] ^ rows_mask), n - ones(column[i] ^ rows_mask)) ones (^ is XOR operator, ones(X) is the number of bits equal to 1). Compute the sum of these values for all columns and find a minimum over all row masks. The complexity is O(2n·m).

    Optimization: Split the rows into two groups of sizes A and B. Iterate over all masks of rows from group A and let's assume it's fixed now (and equal to X). For each column compute how many bits are equal to 1 in XOR of X and that column (let it be C[i]) and also let R[i] be a mask of remaining B rows for that column. Let's compute how many columns have the same values of C[i] and R[i] for all pairs of (C, R) (the number of these pairs is A·2B). Now, let's fix the mask of rows from group B (let it be Y) and iterate over all pairs of (C, R), each group will contribute min(ones(Y ^ R) + C, n - (ones(Y ^ R) + C)) * cnt(C, R) to the overall sum. Notice that we actually don't need to iterate over all pairs (C, R) as it's enough to compute prefix sums for all C for a fixed R and then we can compute the minimum in O(1) using them. The complexity is O(2A·(N + 22B + 2B·A)) assuming that ones(X) works in O(1). To choose A and B properly I just used a simple for loop that tried all possible pairs, although one could easily find it on paper (e.g. for the max test the optimal values are A=12 ans B=8).

    UPD: ilyakor has already mentioned this approach without prefix sums

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

      Thank you all a lot for three completely different solutions!

      @Petr — I tried this approach during the contest, but didn't manage to do the DP — It's good to know that it's possible to finish that and now it's clear from your code how to do it exactly, thanks!

      @Lewin — wow, I didn't expect anything like that

      @ilyakor and KADR — indeed, your approach is slower, but surely easier to come up with, nice!

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

Очень жаль, что раунд не рейтинговый. Ждём следующий раунд с нетерпением!

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

Below are 2 codes for DIV2 C

http://mirror.codeforces.com/contest/664/submission/17351450 above solution passed pretests

http://mirror.codeforces.com/contest/664/submission/17351613 above solution gave tle on pretest 1

What is causing code 2 to run slower than code 1?

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

    Although due to mis-understanding the constraints of the problem, my code failed the system testing, but my code passed pretests and your's gave TLE on pretest 1 because your preprocesing loop, the one filling the map, runs for ~(2*10^5) times. Mine runs exactly half of it.

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

It's so sad to know the contest is unrated after it finished for a student who stay up late to be a Candidate Master:( If I know it's unrated I'd chosen to go to bed early.

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

I has been long since the last rated contest. Please make the upcoming Educational Round rated. Rated contests are definitely more fun.

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

It has been long since the last rated contest. Please make the upcoming Educational Round rated. Rated contests are definitely more fun and challenging.

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

when will sytests start ?

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

How to solve this problem: http://www.codeforces.com/contest/664/problem/B Unfortunately my solution got hacked. Can anyone tell me the correct approach? Thank you

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

It's so sad to know the contest is unrated after it's finished for a student who has stayed up late to be a Candidate Master:( If I knew it's unrated I would choose to go to bed early

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

Why the compiler doesn't execute a lot of problem A c++ solutions?

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

Что означает "Отказ тестирования"?

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

It would have been much more fun if the contest was rated. Anyways good contest !

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

Хммм... Я получил на A "Отказ тестирования". Вроде бы это означает, что я читак и копипастник, но: 1) Это не так; 2) Задача такая, что много решений будут иметь такой же вид.

P.S. Отбой, все норм.

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

Lol, only two people in my room managed to solve 2 problems)

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

What is the logic for DIV 2 C ?

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

    We have string representing our "short year" (call it S). Let's denote ans(S) that calculate answer. Fact: if we have suffixes of S S1 ans S2; |S1| < |S2| then ans(S1) < ans (S2). So we can build answer suffix by suffix. Assume we built answer for suffix Si (|Si| = i; ans(Si) = Ai). So A(i + 1) > A(i). A(i + 1) % 10^(i + 1) must be equal to S(i + 1) % 10^(i + 1) and A(i + 1) must be minimal. We can represent A(i) as k * 10^(i + 1) + r (0 <= r < 10^(i + 1)). Now we have 2 cases:
    1) S(i + 1) % 10^(i + 1) > r. Then A(i + 1) = k * 10^(i + 1) + S(i + 1) % 10^(i + 1). Easy to see that A(i + 1) correct answer.
    2) S(i + 1) % 10^(i + 1) <= r. Then A(i + 1) = (k + 1) * 10^(i + 1) + S(i + 1) % 10^(i + 1).
    Now if we assume A(0) = 1988, then A(|S|) = ans(S).

    Example. S = "015".
    A(0) = 1988 = 198 * 10 + 8. S1 = 5. 5 <= 8 => A(1) = 199 * 10 + 5 = 1995.
    A(1) = 1995 = 19 * 100 + 95. S2 = 15. 15 <= 95 => A(2) = 20 * 100 + 15 = 2015.
    A(2) = 2015 = 2 * 1000 + 15. S3 = 15. 15 <= 15 => A(3) = 3 * 1000 + 15 = 3015.
    So answer for S = "015" is 3015.

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

    You want to know what number chose that suffix. Simple observation from that is that each suffix of the suffix (except itself) was chosen before.(otherwise there was at least one smaller than itself,and it wouldn't choose it).

    Now this is how I find the number. Let's take 3098 for example. You can also see that one which chose 8 is before the one who chose 98. Now the greedy approach is simple.Calculate who took the suffix with length 1,call it VAL. Calculate who took the suffix with length 2 and it's >VAL,... and so on. If you want to find the number which has the suffix p,the number looks like prefix+p (0<=pref<=inf).

    In my solution I just binary searched prefix,and took the prefix which gave the smallest number > VAL. I saw other people just brute-force to find prefix(even if for prefixes of length 1 and 2 it takes some hundred steps,for other lengths is seems like it takes maximum 10).

    Hope I helped you understand the greedy approach.

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

    Example: IAO'1999 => from right to left: 9 => 1989 | 99 => 1999 | 999 => 2999 | 1999 => 11999

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

Can upsolving be enabled for the official contest? In particular one problem is not shared (Gambling Nim) and I want to submit for it.

EDIT: It's been enabled!

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

So much drama in one blog

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

Есть разбор задач?

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

How to solve Div1C / Div2D : Graph Coloring ?

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

    well , we have two options for the final color (1 — red , 2 — blue )

    suppose we want to color the graph with red

    for each component this is the algorithm :

    suppose we have a vertex v in this component .

    again we have two options : change the color of all edges adjacent to vertex v , or don't do anything with v .

    when you choose this option , you can run a dfs from this vertex , and you will know for each vertex of this component , what you should do with it ... (change it or not)

    after that , you know what to do with the vertices of that component :D ( while running dfs , if you changed one vertex , you can mark it in a bool array or sth ..)

    now you can easily know , what would be the color of the edges of this component ... (by using the information of each initial edge and the bool array we used) .

    if all of them were equal to the final color (here it is red) , add the changed vertices to a list.

    now , after you tested the 2 options for each component , if just one of them worked , just add it the the list of vertices for the final color which should be changed .

    if both of them worked , add the one with the minimum number of vertices

    and if none of them worked , sadly we can't color all of the edges with this especial color ( which was red here)

    now do the same thing for the blue color

    if you had 2 final list , print the one with minimum vertices

    if you had only 1 list , just print it

    if you hadn't any , print -1 :D

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



That's why I hate Dynamic Scoring..

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

Hopefully we will get the editorial soon.

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

Will there be an analysis of all the problems?

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

Can anyone tell me why the following approach fails for D div.2 (Graph Coloring):

  • pick any node and test 4 configurations: flip or not flip the node; try to color all edges to R or B
  • perform a bfs and flip nodes to obtain correct edge color (all nodes are processed once)
  • if at the end all edges are of the same color, then this is a correct solution
  • find the one with the least flips

By flip i mean change all edge color going from and to the node. Is the approach correct? Maybe I have an implementation problem.

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

Why Petr didn't participate?

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

Any Idea for solving DIV 2 D , using DSU ?

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

Hey, for problem "To hack or not to hack", the tests are really weak, aren't they. I do a very silly greedy and still pass: Iterate through the list and try to minimise anyone higher. Is there anyone else having the same idea?