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

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

Всем доброго времени суток.

Скоро состоится Codeforces Round #315, авторами которого являются студенты УрФУ sivukhin и Um_nik. Это второй наш раунд, первый пришелся на черные дни Codeforces, и мы надеемся, что второй наш раунд не вызовет таких катаклизмов :)

Мы хотим поблагодарить команду Codeforces за эту замечательную платформу и Polygon. Особенно хотим отметить Zlobober за помощь в подготовке задач.

Желаем всем удачи!

UPD1:
Разбалловка.
div2 : 500-1000-1500-2250-2750
div1 : 500-1000-1500-2250-2500
Настоятельно рекомендуем прочитать условия всех задач. Мы постарались подготовить достаточно разнообразные задачи, вполне возможно, что сложные для нас задачи будут простыми для вас.

UPD2:
Разбор

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

div1:
1. KAN
2. Petr
3. enot110
4. tonyjjw
5. Konijntje

div2:
1. Lost
2. loser21
3. fyiwxp221
4. hqpwca
5. LazyWolfLin

Всем спасибо за участие.

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

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

Желаю всем адекватных результатов.

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

One suggestion to Codeforces team, Please do not allow someone to name their handle which has slang or obscene word or may be their handles are part of it. Thanks.

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

where's your previous round? "I don't know what black days are."

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

скажыте пожалуста раунд будет рейтинговый иле нет?

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

Good luck to everyone!Wish you high rating! And thanks sivukhin and Um_nik for this round! It's good to have another chance to practice more!

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

Here's a suggestion: Please hold more contests at 17:00 ~ 19:00 Moscow time. That time is more available for Taiwanese and Chinese coders. There are many of them!

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

Это число и Цукермана и Хардаш`а, но почему это просто раунд 315?

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

Почему количество комментариев, которое указано под темой не соответствует их фактическому количеству? (до моего комментария система говорила, что их 32, фактически было 16)

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

Чувствую ненадолго я в синие вернулся ;)

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

Сравниваешь английскую и русскую версию и понимаешь, как богат руский язык ;)

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

Я оставил комментарий, который за 4 часа собрал -180. Я мог оказаться на 8 месте в списке Бредора http://codeforces.me/blog/entry/15998. Но опущенские модераторы его удалили! Позор им!

Раунд #315 провален, можете расходиться :(

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

I missed those black days of codeforces,but happy to witness black days of topcoder :)
Hope they will overcome too.

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

World Consumer Rights Day Round!

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

Your problems in the previous round were very interesting I hope this round will be the same :)

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

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

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

This round shuld be called #NotPI :)

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

This time they told Score distribution SOON ;) THANK YOU |: ################################################################################

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

Это ваш первый раунд?

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

You know, Div 2 contestants should not compete in Div 2-only rounds....the irony!

Edit:I know this is a div1+div2 round, just saying...

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

"U contest" sounds good to me. Because Organised by "U"mqra and "U"m_nik of "U"ral "U"niversity .

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

Эм, а почему стоимость задач div1 не соответствует стоимости задач div2, как это обычно бывает?

То есть, если div2: 500-1000-1500-2250-2750, то div1: 500-1250-1750-...

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

    Не видел правила, согласно которому это обязательно должно выполняться.

    Поэтому: почему бы и нет :)

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

Problem E costs 2750, it going to be interesting!

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

hope to not see Succesful Hacks on Div 1.A :D

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

I was away from CF for few weeks and what's this? They are no longer declaring the score distribution at last moment! When did people started playing safe?

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

WTH with A?

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

​

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

Codeforces is hanging. Can't read codes of roommates.

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

When B has more solves than A...

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

Is the answer for DIV1B this sequence?

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

Why 10^9 in div1A is AC? I am about the solution without Sieve of Eratosthenes.

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

a bit hard contest , Just a Bit

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

Funnily enough, I solved A but not B. Can someone help me find the bug in my code (I keep getting a runtime error on test 7)? http://pastebin.com/tYXaAaEx

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

Guys, why SolveB was easier then A? More people solve B!

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

Какой threshold в A?

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

How to solve B(div1)?

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

Problem A has the worst statement i have ever seen in my life, i don't want to ofend you guys, but it was really bad, poorly explained, i don't like to do try/error on contests, even the clarification did not help much either.

Overall felt the contest was rushed and not tested enough (statements where not good) that is my opinion , of course people that guess the tasks only by input and output are going to give me negatives, but i don't care, had to speak up.

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

Does anyone have something better than randomization for div1 D?

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

What is solution to Div1C? Is 2-sat involved?

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

Div1C Крайне плохая задача для двух-часового контеста.

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

That moment,when there are two cheaters in your room and u hack both of them :)

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

problem statement for problem A.(MUSIC) was very poor had to find meaning from test cases

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится
  • Why were the TLs in C-Div1 so strict? I lost much time optimizing my 2-SAT in order to pass the pretests.
  • Also, D is very similar to this task on Polish SPOJ: http://pl.spoj.com/problems/AL_09_04/. Translation: There are n points on the plane. Can you cover them using k lines? By the way, has anyone tried solving the problem using meet-in-the-middle technique?
  • »
    »
    11 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +12 Проголосовать: не нравится

    tfw you optimise againt TLE and get RE instead

    also tfw I know I'm going to get WA

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

    There is no need to iterate through all characters from 'a' to 'z' while finding next symbol. One can observe that we can change any vowel to other vowel, and any consonant to other consonant, and the status of the transfromed string will be the same, e.g. whether it's in language ot not. So, finding next symbol requires exactly two 2-SAT checkings and therefore, you can solve this problem in O(NM),

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

      I had this optimization from the very beginning.

      What I did later was: (a) change the adjacency list in 2-SAT into adjacency matrix, (b) return -1 if M > 3N(N - 1). It worked something like two times faster and it passed pretests. (Of course consonant-only alphabets killed me...)

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

      I wasn't iterating through all characters and still barely managed to fit within TL, spending 35 minutes and 10 attempts to make it :)

      Rough bound which I got: 200*200*4=160000 rules; 160000*2=320000 edges in my graph. 320000 on DFS + 320000 on RDFS=640000 operations on getting strongly connected components.

      200*2=400 calls of 2SAT while looking for LCP of answer and word from input; 200*2=400 more calls of 2SAT while restoring answer.

      640k*800=5.12*10^8.

      Quite a lot, now I am not surprised with TL16 :)

      I am pretty sure that it can be implemented much better (and I'll look at other implementations to learn how to make it faster, thanks to authors), but looking at list of attempts with TL16 during contest — I am not the only one who struggled with it :)

      At some moment, looking at guys with time <0.1 on pretests, I thought "OK, I screwed up with wasting a lot of time on implementing obvious solution while I had to come up with something smart".:)

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

        mnbvmar, I_love_Tanya_Romanova, I see you. Indeed, I didn't think straightforward approach could lead to TLE. Sometimes it's better to spend more time to think and use not the very 2-SAT algorithm, but only ideas from it)

        We can find transitive closure of 2-SAT graph in O(NM) before processing string, and the only information we use from it is reachability from a to !a and vice versa.

        Now, when we have some prefix, we can fix vertices that must be visited in any case (respective to positions in prefix), and after that, while processing two vertices correspoding to other positions in string, we can use information about reachability to decide whether vertex to use.

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

Looks like about half of the solutions for div2 A are failing...wow...

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

O(n^2) space complexity solutions are getting accepted for Div. 1 B ? Like seriously ?

EDIT : so wow , much butthurt. I should write these kind of opinions on the complexity of solutions more often just to see the "butthurt impact" it has on people.

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

Thanks for the awesome contest (especially D and E)!

To get D accepted, I need to add "if (k == 0) return;" to my solution. First I lost Yandex because of a bug in the prime number generation, then this :(

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

Can someone explain what did DIV 2 A want us to do? I spent around 60+ minutes, and found it very unclear/contradicting. Not complaining about problem statements, but can someone explain it? Not the editorial, but phrase it in a better way.

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

Bad luck!... Get AC after change EPS from 1e-9 to 1e-6 :( ...

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

Waiting for Editorial. I want to see jury solution of Div1. D.

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

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

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

Hoped to stay in Div 1 this time, but because of a really stupid mistake in Div1A, will probably go back to Div 2. :(

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

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

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

I only submitted B, and got a rating rise :D

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

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

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

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

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

it was the worse A that have been prepared !!!!! i solved B in 7 min and C in 20 min But not A !

but other problems were fantastic!!! WOW ;)

thanks for reading!

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

Not my best performance, plus part of code editing is hidden under Chrome, but still — screencast

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

I had an unusual and impressive experience in this contest. My program for problem C outputs -1 after running about 1.9s. And I allocated a block of memory with the size of 1000000. In my computer, my program only used 1/3 of the memory I allocated. During the contest I tested my program and everything went well. However on the grader, it runs much more faster and used all the memory within only about 1.8s seconds so it got RE before it output -1.

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

Amount of accepted solutions to A which had "Palindromic tree is better than splay tree" in code is damn too high!

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

For 569C - Primes or Palindromes?, reading the problem statement, how can one determine — "Up to which number he should calculate the number of prime and number of palindrome number" ?

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

I forgot to use long long and get Wrong answer in problem 568A. TAT

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

I can't understand 3rd sample test case in B div1 "B. Symmetric and Transitive"

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

    1)empty set 2){x, x} 3){y, y} 4){z, z} 5){x, x}, {y, y} 6){x, x}, {z, z} 7){y, y}, {z, z} 8){x, x}, {y, y}, {x, y}, {y, x} 9){x, x}, {z, z}, {x, z}, {z, x} 10){y, y}, {z, z}, {y, z}, {z, y}

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

i think "E" can be solved with "divide and conquer & dp". this problem look similar to "http://codeforces.me/problemset/problem/101/E" ( my code : http://codeforces.me/contest/101/submission/13598464 ). they are similar because of limited memory.

we can solve 568/E using very basic idea. maintain length of longest sequence from any index i to n. if there is gap at i , store for all m numbers. if not a gap, only for one number. but it will take O(m*k + n) memory = ~10^8. now, divide the array into bucket of size sqrt. we can store all the information for first bucket. when we are done with first bucket , process second and so on. Space compexity = O(sqrt*k + n) ~ 3*10^7. decide the bucket size accordingly. Time complexity : O(m*k*FenwicktreeLogn(n)) .

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

i think problem "E" can be solved by "divide and conquer & DP". there is a problem with much similar idea ( http://codeforces.me/problemset/problem/101/E ) with my solution ( http://codeforces.me/contest/101/submission/13598464 ) .

The basic idea for this problem is to maintain a DP for each index i which store the maximum of length of LCS from i to n. if array has gap at i, then store for every m numbers , otherwise store for only one number array[i]. TimeComplexity : (m*k) which looks fine. Space Complexity : O(m*k+n) ~ 10^8 > 128MB. to resolve this problem, we can divide the array into blocks of size SQRT. now, store all the DP states for 1st Block , then 2nd Block and so on. so Space Complexity : O(sqrt(n)*m) ~ 3*10^7 , which looks passable. decide the bucket size accordingly.

Edit : Space Complexity does not passes. looks slightly greater than expected.