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

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

Дамы и господа!

Уже завтра, 2 февраля 2017 года в 16:35 по московскому времени состоится раунд на Codeforces для участников обоих дивизионов.

Вместе со мной задачи для этого раунда придумывали и готовили одиннадцатиклассники московской 179-той школы s17b2_voroneckij (Дима Воронецкий), ilya_the_lamer (Илья Паузнер) и akvasha (Антон Кваша). Также автором одной из задач является KAN (Николай Калинин).

Неоценимую помощь в подготовке задач нам оказал координатор Codeforces KAN (Николай Калинин). Традиционно мы благодарим MikeMirzayanov (Михаила Мирзаянова) за замечательные платформы Codeforces и Polygon. Также хочется поблагодарить Endagorion (Михаила Тихомирова), winger (Владислава Исенбаева), AlexFetisov (Александра Фетисова) и cdkrot (Дмитрия Саютина) за вычитывание условий и прорешивание задач.

Участникам каждого из дивизионов будет предложено по 5 задач. Некоторые задачи будут общими для обоих дивизионов. Разбалловка будет опубликована позднее.

Всем удачи!

UPD: Разбалловка:

Div1: 500-750-1500-2000-2500

Div2: 500-1000-1500-1750-2500

UPD2: Контест закончился. Надеюсь, всем понравились задачи.

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

Div 1:

  1. EvenImage

  2. V--o_o--V

  3. TLE

  4. SkyDec

  5. uwi

  6. Belonogov

  7. aid

  8. dreamoon_love_AA

  9. Um_nik

  10. Andrei1998

и Div 2:

  1. ljh2000

  2. MashiroSky

  3. squaredog

  4. _Reborn_

  5. Factorio

  6. Dirak

  7. lnjlnj

  8. Manchery

  9. SarvagyaAgarwal

  10. mik

Разбор опубликуем очень скоро.

UPD5: Разбор

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

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

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

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

I am new to programming and I have visited number of coding sites and I found Codeforces one of the best coding sites on the Internet. Coding rounds like this are so amazing. I really enjoy coding on Codeforces. Thanks a lot for making coding site like this.

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

I hope it won't end up unrated like yesterday :\

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

Time collides with Hackerrank's HourRank. I'm a pupil. I'll probably end up participating in both contests.

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

Hope the Codeforces polygon won't be unstable this time, or this round will remain unrated too... :( Anyway, I'll try my best to work on the problems no matter whether it's rated or not. :)

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

the round rated?

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

A week without any rated contest, hope this contest doesn't have any bugs like the previous one:)

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

blue coders prepare a contest for Red coders. Amazing :)

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

Ez Sliv

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

Hope codeforces is stable today and we get a rated contest! :)

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

Hopefully we get something other than math and greedy for Div2 ABC :)

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

The answer is Yes, right?

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

Подскажите пожалуйста, зарегистрировался на соревнование, а, как оказалось, поучаствовать в нем возможности не будет(

Можно как-то отменить регистрацию, чтобы не потерять рейтинг?

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

I hope to see some physics problems this round :)

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

I hope this time we don't have any problem with the server. I got trauma from this image in the previous contest.

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

Finally Div1 & div2 separated

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

CodeForces is toooooooo slow from here Hope not a server error

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

A good time for Chinese students!Hope it will be a good warm-up round for the Chinese Winter Camp next day.

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

Автокомментарий: текст был обновлен пользователем platypus179 (предыдущая версия, новая версия, сравнить).

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

Hope that this time contest doesn't go unrated.

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

I hope that this contest will be interesting :)

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

I hope all is well this time! :D

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

PC hanged while reading problem A. Forced shutdown and restart. More than 3400 submissions on A and 1800 submissions on B. out of competition :(

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

What does "more" in div1D mean? more pairs or more vertices?

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

In the input of Problem C from div2, u < v , or it doesn't matter?

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

Very Nice Problems! :D I made a history for myself, this is the my First Time to solve graph related problem! Trees are so much fun! Hooray Rating!

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

problems like shit .

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

The gap between div2C and div2D problems is far bigger than 250 points imo.

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

Problem set of this contest was nice. Although Problem D deserved 2000 points imo, if not 2250, since the difficulty gap between C and D was too high.

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

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

Is this an IQ contest or something ??????????????

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

How to approach problems like Div2C which require dfs to calculate answer?

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

How to solve Div1 C??

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

Div 1C is the same as this problem http://codeforces.me/gym/100451/problem/I.

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

On problem D, my output for the first test is:

YES
3
2
2
1
2
1
2
1

Why does it give WA?

Here are the rectangles, black numbers are indexes, brown numbers are color. No same color touches:

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

No Hacks This Time :) !!

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

How to solve Div1 B??

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

How to solve div2C ?

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

    I solved it using greedy technique.

    The solution is that we define f(u) for vertex u as the number of adjacent vertices to u like v such cu != cv. then choose the vertex with greatest f(u) and check if erasing it from tree annoys him or not! if not, the answer is "NO". otherwise, print this vertex.

    I hope it would pass sys tests. ;)

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

    Assume vertex #1 is the root. For each child C of the root check whether all elements in subtree with root C are the same color as C. If you found vertex of different color — make it a root of your tree and do this checking one more time but now print NO if found different color.

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

    My approach- Consider all such edges that connect two vertices of different color. Let's call them heterogeneous edges.

    There will be an answer iff there is one vertex common in all the heterogeneous edges. And that common vertex will be the root.

    You don't even need to build a graph. It's elegant...well, only if it's correct. :D

    Edit: It is correct. :)

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

Моё решение C: Дфс от 0 вой вершины. При переходе от вершины к вершине ищем первую не совпадающую по цвету. Считаем, что она — искомая, после дфс2 запускаем от уже найденной вершины. Если в её поддеревьях есть различия в цветах, то(тут нужно ещё раз запустить дфс2, но уже от 0вой вершины (она тоже может быть искомой)) выводим NO, иначе YES и название изначально найденной вершины.

Тут лежит часть моего кода по этой задаче

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

    Мое решение: "плохое" ребро — ребро между вершинами разных цветов. Пусть мы взяли дерево за вершину и оно не раздражает. Тогда в поддеревьях нет плохих ребер. Значит все плохие ребра выходят из вершины, за которую мы держим березу. Посчитаем для каждой вершины количество плохих ребер, входящих в нее. Если для какой-то вершины это число совпадет с общим числом плохих ребер, она — нужная нам

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

I think it was better that task D worth 2250 points, it seems really tough for lots of competitors

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

Div2 A .. very bad statement

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

Does anyone knows the test case of pretest 7 of problem C in the div 2 contest. It's like a freaking walls.

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

For description of DIV1 E. I think you should let (1<=l<=r<=100000) be (1<=l<=r<=n)

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

Thank you for the nice problemset! I really enjoyed this contest!

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

How to solve D...I thought about turning it into a graph and then DP it but I thought it would be too messy and I didn't know how to handle cycles could anybody who has solved it explain his/her solution ?

My DP was going to be DP(node, which color this node is)

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

    If you mean Div.2 D, there is a simple trick. Let's say that the top left corner of rectangle 1 is (X1,Y1) and rectangle 2 is (X2,Y2). As the rectangles have odd length, they can only be in contact if either X1-X2=1 (mod 2) or Y1-Y2=1 (mod 2) or both. In other words, two rectangles can not be in contact if the modular 2 of the top left corner is the same. There are four possible ways for (X,Y); (0,0), (0,1), (1,0), (1,1). Assign a color for each.

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

How to solve Div2 D? I assume it is graph constructing and coloring problem. Can you give some hints if it's so? Otherwise please tell me that it's wrong approach.

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

I solved Div. 2 C with DSU. I don't know if it's wrong, since many people solved with normal DFS. How would you do normal DFS though?

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

Very nice div2 D! That was wonderful

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

Nice hack case to C: n=m-3 and sequence lacks 3 elements that don't form arithmetic sequence.

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

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

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

Div2D was awesome . How to solve it if the dimensions of the rectangles can be even too ?

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

What was the expected (or popular) solution to C? I noticed that, given and , we have a quadratic equation on d, though I somewhat expect to see many probabilistic solutions.

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

    I tried all possible starts and found d from equation, then verified that sum of squares is same as well. Not sure that it will pass.

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

    The difference between any two element is kd, and we can use the number of occurrence of kd to compute k since k1d = k2d implies k1 = k2.

    If we choose kd to be the smallest difference between any two elements, the number of kd can be counted in via sorting. Suppose we have c pairs of element having difference kd. Originally I take k = n - c, but this is correct only when 2n < m and I didn't notice it until the last 15 minutes. I "flip" the sequence to fix it but maybe it's not necessary. :P

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

    I'm sure that the number of (x, d) satisfies two equations is O(1) (It can be three or more equations). So the complexity may be O(NlogN).

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

Div1 A is so simple..

Spent about an hour trying to write hard dfs-tree-based solution. Finally got simple idea, coded in 4 minutes:

All the edges (u, v) such that color[u] != color[v] should have one common vertex. This vertex is the answer. Otherwise, there is no answer.

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

Me after reading Div1-B solution

Best Div1-B problem ever (even though I failed to solve it).

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

Didn't notice, rather didn't pay much attention to the fact that lengths were odd inspite of it being in bold for Div 2D. Ended up thinking about general case and hence wasting the whole time :(

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

I know there's an easy solution for D, but what if the sides can be even too? I think this will work, correct me if I am wrong: Create 2 arrays, one for vertical sides and one for horizontal sides, sort each of them by y/r, then by beginning and end of a side. Then we just use two pointers to find all intersections of rectangles and build a graph. Then just DFS in this graph. I tried to implement this but the round ended. Do you think it will fit into the time limit?

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

This is my second time to participate in codeforces, and now or unrated, I hope this will be integral.

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

Nice problems. I really enjoyed. ty

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

When will be rating updated ?

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

After seeing this 24373708 solution for Div2D/Div1B —

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

It seems the standings page is a bit bugged.

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

Due to slow response time of the website and slow rating changes, this contest will be unrated.

Have a great day!

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

Problems like today's Div 1B make me feel handicapped :| Such an easy solution, yet I was nowhere near it during contest

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

it so unfair to solve a simple problem in o(n) to recieve a TLE because of input time , this is the first time this happens to me on codeforces , i dont wanna bring up the conflict of java vs c++ but this shouldnt happen :'( http://codeforces.me/contest/764/submission/24371107 http://codeforces.me/contest/764/submission/24388501

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

    I am a java person too.

    For large inputs you need to use BufferedReader for input, and for large outputs you need to do PrintWriter.

    CodeForces has done this to me multiple times. It sucks I know.

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

Is it just me or Codeforces lags really hard?

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

раунд рейтинговый?

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

How can O(z^2) algorithm get Accepted in Div2 A. I was trying to hack this code by giving the test case 1 1 10000. And I think this code does 10^8 operations for the particular test case. Then why didn't it gave TLE?

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

It seems that some people knew that C appeared previously at Saratov training camp.

Compare the following 2 solutions: 24379628 24373544

There may be other people with the same code but I assume the plagiarism test should detect it. What will be done in such a case?

Edit: Huh, looks like nothing has been done. platypus179 are you going to overlook this?

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

    Et tu, moejy0viiiiiv? How sad.

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

    I have read such sentence in the rule: Solutions and test generators can only use source code completely written by you, with the following two exceptions: the code was written and published/distributed before the start of the round, the code is generated using tools that were written and published/distributed before the start of the round.

    So I don't think it is cheating.

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

      Well, yeah, it's not cheating obviously because you didn't share it with anyone else. I didn't know about the rule you quoted(I've never even read the rules, heh). I just supposed that the plagiarism test would detect this and some kind of announcement would be made by the authors.

      So, in conclusion, it's fine to use code that was published before the start of the contest and it's the responsibility of problem setters to guarantee the originality of the tasks.

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

      I must ask how did you find this problem? Did you remember it from solving or was it some very clever Googling? I am very impressed because the problem statements are fairly different, even though it is the same problem I suppose :)

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

It looks like two first coder's solutions for div2E is same. Compare:

24380405

24382432

UPD: their D codes looks similar too

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

    and they are from the same school :|

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

    High possibility that both two ids are fake id of a red coder :| Their graph's are same too :| But going trough their past submission it seems that they write code in same style .. :) Since they both from same institution :) But there are still many codes that they shared :| :| i.e exactly same

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

      No,No,No,our school training program always contains many problems in codeforces,so we ususally solve the same problem.We share our solutions,because our teacher encourage us to have discussions together,it's a part of our study program,too.

      If you say we are fake id of a red coder,that's interesting.And I really hope my id can become a red id one day.:)

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

    First,I have to say that this problem has been done by all of my classmates in our teams.As you know,we come from the same school and the same city,and I want to tell you that div2 E has appeared in our school test we attended in the past.

    Also,that problem has been published by our fellow students in China before,our teacher can prove that we all solved the problem ourselves,because she has told us the solution to the problem a month ago when we first read the problem which is similar to the div2 E(maybe a little different,but the solution is similar,too).

    If you say we write code in same style,what I want to say is that we have studied together for two years,and all of my classmates' styles are the same.:) I have to say if the code has been written and published before the start of the round,if I need to write it again,and our classmates are taught by the same teacher,and we all have the solution by our fellow students,it's not difficult to explain this situation.

    div2 E is a difficult but intersting problem,I hope you can solve this problem soon,too.:)

    UPD:div2 D is also a interesting problem ,maybe everyone who has solved this problem used the same solution.:)

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

Автокомментарий: текст был обновлен пользователем platypus179 (предыдущая версия, новая версия, сравнить).

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

Why rates changed for previous contest?! :|

UPD: It's fixed now

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

There is something weird going on. The ratings for Round 394 are getting updated in few profiles.

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

Why this —

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

Problem B was copied :-|

Tournament of Towns problem 5 is div1 B exactly!!

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

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

почему рейтинг октатился обратно?

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

I'm new to competitive programming. and this is my first contest that I have managed to solve at least one problem; although it became unrated, I learnt a lot!

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

my solution for Div2C get Accepted http://codeforces.me/contest/764/submission/24389994 but this solution should get WA on the following test :

11

1 2

3 2

4 2

5 2

6 2

7 2

8 2

9 2

10 2

11 2

1 1 2 3 4 5 6 7 8 9 10

Weak tests!!

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

can anyone tell the hack for question B of div2?

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

Finally purple ^_^

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

Very nice contest. I like C task!!!

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

The testdata for the C is weak, This code 24392371 passed

It doesn't pass this case:-

4

1 2

1 3

3 4

4 1 5 3

I sent it during the contest then i realized that the idea is wrong so I changed it but I was surprised after the contest that it passed system tests.

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

http://codeforces.me/contest/763/submission/24391818

Hey guys just wanna share a greedy solution to the problem Div2C I just came up with. First I have to find all the connected pairs which has different color. Then I divide by 2 because some will be repeated. And then I will just find out if there is any vertex that has the same amount of connected vertex with different color as the total sum. That vertex will be the root. Hope my solution help.

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

I came up with an O(n^2) solution for the second exercise but I got a TLE. Was the maximum time limit allowed O(nlogn)?

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

    there is a simple O(n) algorithm

    note that each item i will be swapped several times against n-i+1

    more precisely, each item i will be swapped min(i,n-i+1) times with its counterpart

    so you check whether each pair will be swapped an even or an odd number of times, if the number is odd, then it is the same as 1 swap, is it is even the same as no swaps

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

Wrong : vector < bool >can_be_child (true,N);
Accepted: vector < bool >can_be_child (N,true);

Took me an hour to notice that bug.

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

    But how did the first one got right answer in first 6 cases ! o.O o.O

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

      It surprised me too. Actually vector < bool > C(true,N) is equivalent to C(1,N).
      It creates a vector of size 1 and initialized it with N. As N!=0 it is taken as true. Hence C(true,N) is equivalent to C(1,true). So basically It created a vector of size 1 initialised with true, but except the first value all other values(extra spaces of vectors) will be false by default.
      Unfortunately all inputs tll tc 6 were such that initialization values didn't affect final answer.

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

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

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

shouldn't all div2 C solutions be re-judged with stronger tests since the test data was weak ? (and accordingly updating the standings and rating changes again)

EDIT:

note to be clear: weak test data of problem C in div2 is not an argument in my imagination, there are two comments or more in this comments section which are describing that their codes give wrong answer on test cases they wrote in their comments but despite that their codes are accepted.

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

Div.2 D is allsome…… -_-||

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

Div1E a lot of solutions can be hacked by the following test: 4 2 4 1 2 3 4 2 4 1 3 2 1 3 2 4