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

Привет, Codeforces!

В Dec/28/2018 17:35 (Moscow time) состоится Educational Codeforces Round 57 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ACM ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Soroush Tabesh Soroush.

Удачи в раунде! Успешных решений!

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

Место Участник Задач решено Штраф
1 chuochuo 7 222
2 Traxex_ 7 270
3 quailty 7 281
4 hitman623 7 285
5 E.Space 7 316

Было сделано 69 успешных и 296 неудачных взломов. Пожалуй, в этот раз обойдемся без таблицы, слишком уж она нерепрезентативна)

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A irkstepanov 0:00
B ChiIIi 0:03
C Qing_Yang 0:06
D aleex 0:07
E chuochuo 0:57
F isaf27 0:19
G 300iq 0:06

UPD: Разбор опубликован

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

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

ggguys i cant wait! !=) X) :)

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

Second last chance to reach my 2018 rating goals lol.

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

hello gays i live in a very wealthy part of the austro hungarian empire and i am wondering if the contest will be worthy of my royal time i request you inform my intelligence on whether the contest will be rated or not

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

However,I love Educational round.

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

YESSS...a div2 round for candidates ;)

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

I hope it would be a great educational

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

Hope I can become hahalmao555huehuekkkxixi after the contest.

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

Today I'll become a Christmas mandarin orange.

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

Nickname?

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

One interesting thing in this contest is that both the description and problem name of problem G greatly resembles Problem D in XVIII Open Cup, GP of Urals. But the solution differs a lot, and actually, the solution to that Open Cup problem is more similar to Problem E of this contest. That's why I think the problem difficulty of E,F and G in this contest should be rearranged, with G being extremely trivial once you know FFT, F being some simple calculation once you know the linearity of expectation, and E needs some combinatorics knowledge(like counting in a multiset and inclusion-exclusion principle). And the number of accepted solutions seems to prove me right.

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

Problem F reduces (at least I reduced) to calculating this sum in small complexity:

for given x, y, m.

Any hints to calculate this?

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

    LOL, LMAO, ROFL. No, it's not solved like that.

    Normal solution: there are three kinds of inversions:

    1. Inversions between known elements — they are calculated by your favourite method (Fenwick / mergesort)
    2. Inversions between unknown elements — if there are P unknown elements, they form P*(P-1)/4 inversions due to symmetry
    3. The last case is when one element is known, and the other is unknown. Let the known element be x, and there are some free places to the left and some free places to the right. For each of free left places, there is an inversion if you put element > x there (find count of these elements by lower_bound). For each of free right places, there is an inversion if you put element < x there (find count of these elements by lower_bound). And the rest is easy.
    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +38 Проголосовать: не нравится

      LOL, LMAO, ROFL. No, it's not answered like that.

      My question is about calculating the sum not how to solve the problem. Anyways, thanks for the solution :P

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

        This is a valid method of calculating the sum in reasonable complexity though, given that it reduces to the same thing (differing by some easy-to-calculate value). You're just counting the same thing in different ways and equating them.

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

        I think you have already figured out how to solve this problem, my reply is too late. :P I was trapped in the same calculation as you. However, after peeking others' solutions, I found it better to calculate the expectation alone, rather than calculate P and Q separately. This problem enlightened me a new angle to calculate expectations. When it is the case that P is hard to calculate, we may try to calculate the expectation directly. Good luck!

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

    First idea and very overkill is next: let and , then your sum is coefficient of zm of a convolution A × B or something like this (if you calculating with modules). Convolution FFT.

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

      If you write A and B in closed form as follows:

      A = x·z·(1 + z)x - 1

      B = (1 + z)y

      and then multiply them, then coefficient of zm in A × B = x·z·(1 + z)x + y - 1 would be simply x·C(x + y - 1, m - 1).

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

    Does anyone know why my nlogn solution is timing out?

    https://mirror.codeforces.com/contest/1096/submission/47665224

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

It's guaranteed that rating of this topic will never exceed 998244353 (by absolute value).

(OK, it's not really)

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

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

number 998244353 everywhere

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

How to solve G? Is it some sort of bruteforce on small strings + DP? Couldn't figure out the details in time.

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

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

How to solve B?

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

is this eduround 998244353?

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

What was wrong with C? I messed it up :(

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

Am I the only one who stupidly thought B answer is x*(x+1)/2

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

Is D f(i,j) = min ans for prefix i such that starting j letters of hard are taken.

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

I got WA on test case 4 for problem D, does anyone know what could be wrong 47654263

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

the solution for C for god sake?

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

What's test case 3 in C?

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

Did someone get AC on G with FFT (not NTT)?

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

These guys are really good :D

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

This user is hoax and the person who hacks his solution needs to be reported or taken down !! https://mirror.codeforces.com/profile/problem_destroyer420 Returns 0 for a particular n and voila hack from another id !

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

C had a nice corner case and D was a nice problem in general. Enjoyed the problems, although it seems difficulty for tail end of problems was slightly mis-estimated.

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

awoo

https://mirror.codeforces.com/contest/1096/submission/47652681

What is wrong with this? In my compiler it shows correct!

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

Fake hack: applese hacked __123456__'s submission to problem A. It has a special if for failing on purpose:

https://mirror.codeforces.com/contest/1096/submission/47640777

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

I got WA on test 4 for problem B, does anyone know what could be wrong 47654945

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

How to solve D?

I assumed that it is optimal to delete only one type of character. Is this assumption incorrect?

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

On problem G. I used Divide and Conquer + polynomial multiplication ,but get TLE However, if someone had used dft & fastpow & idft , he would have AC

My IQ is not enough to figure out the second way(it's 23:30 in China), but these two ways have the same time complexity O(nlogn)

Although I think it is ok not to let me pass, but I'm very sad. With this problem I would become Orange(my current rating is 2097)

TAT

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

Problem F is similar to SRM 470 Division 1 — Level Two

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

I want to check if my code is wrong, so I hack myself.
I write a program in python3 to hack problem C:

print("180")  
for i in range(1, 180):  
    print(i)

but system said "Validator 'val.exe' returns exit code 3 [FAIL Unexpected end of file — token expected (stdin, line 181)]", can somebody help me to solve this problem?

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

For problem G, could someone provide an explanation of how to deal with MOD in fft?

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

How can someone hack problem C if they have included all possible values of angle in pretest #3?

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

To problemsetters, G is definitely a cool problem. However, do you really think it is suitable for contests rated for Div2? This problem could be easily solved by just copying FFT templates. I think this not fair to the newcomers who has problem solving skills but didn't know much algorithm yet. I think putting these kind of problems in the problemset will cause the rating to be less accurate.

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

    Even though ERs sound like regular Div2 and behave like regular Div2, we (authors) still believe that it's not a regular Div2. That's why we allow ourselves more freedom in using "well-known" ideas (but still trying hard to find a balance).

    Of course, it will lead to some disturbance of ratings, but it's a thing we should deal with.

    On the other hand, if newcomers wouldn't confront new for themselves but famous in community tasks, they will not learn them. And I think, ER is a perfect place to meet with such tasks.

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

      I agree. If it wasn't for educational rounds, this task would not fit anywhere on Codeforces. It's too easy for Div 1 D/E, and putting it in a regular div2 round seems strictly worse than putting it in a educational round.

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

In problem A, in the output format it is clearly stated that the answer in the i-th line should correspond to the i-th query but I just saw a submission who has printed l and 2*l in seperate lines but the verdict is ok. Is it actually fine to print it on seperate lines?

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

It be like that sometimes. F

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

please stop making contests

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

How to solve F ? Or atleast is there a way to find total number of inversions among all the n! permutations

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

how to do C?

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

    Handle ang = 179 separately, n= 360;
    (This is because for every angle less than 179, we can attain it using a polygon with no. of sides n <=180)

    For other values of ang:
    Start with no. of sides s = min(3, ceil(360/(180-ang)))[This checks if the minimum angle possible in the polygon is greater than or equal to ang ] This was derived from, angle of a regular n-gon = (n-2)*180/n;

    Now we need to satisfy,
    i*ang == j*180; (for some s<=i<=180, and j<i)
    (Idea behind this is: ang/180 == j/i; ie "ratio of ang to the total angle of a triangle" should be equal to the "ratio of no of sides opposite of ang to the total no. of sides of the polygon") This can be done by brute-forcing on i and j;
    Thus complexity is O(n^3).
    Here's my submission.

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

    Let t = gcd(180, ang). Result will be  - 1 if ang = 180, if , otherwise

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

When you have no idea for C, so you decide to build regular polygons and check all angles between them until you've precomputed the answer for all angles...

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

Peace on You All :D

I Have a question in "D" Problem .. Why my Greedy Solution is Wrong ?Here

The Idea Is ,

If i delete all character ( 'h' , 'a' , 'r', or 'd' ) it will be impossible to get subsequence = "hard" is that right ? but this is not the all answer the rest is coming

this is how i choose characters to delete character "d" i delete if there is a subsequence = "har" before .

character "r" i delete if there is a subsequence = "ha" before and i will walk to last "d" i choose to delete .

character "a" i delete if there is a character = "h" before and i will walk to last "r" i choose to delete .

character "h" i delete and i will walk to last "a" i choose to delete .

and i will print the Minimum of all that . Why This is Wrong !

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

In problem C, that line print −1 if there is no such n made me question myself a several times.

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

I have no idea how to solve C , can anyone help how to solve ?

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

so much math ._.

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

I think ideally, an accepted problem C cannot be hacked nor fail main tests. As the pre-test 3 checks all possible 1<=ang<=179.

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

In what complexity should E be solved? My O(N*S*2) solution doesn't pass.

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

can someone explain intuition behind D? i tried some people's solutions and coded them but i still don't fully understand them.

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

i don't know why the answer of task 178 is 180, but not 90 on problem C!!!

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

when will you provide tutorials

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

what meme around number 998244353?

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

    Needed for NTT, one of the solutions for problem G. Specifically, NTT needs that your prime modulo be off the form n*2^k +1. That mod fits. Presumably, they used it through the whole contest to not give too much away.

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

Can anyone explain the logic of D?

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

    dp[i][j] is minimum ambiguity when we are at prefix j of string "hard". So,we are at state (i,j) and in next index (prefix j+1) comes, we have two choice, either to remove that letter or continue without removing(increasing prefix) and in next index any other letter arrives,we will be in same state. hence transition will be if(next index is next character after j) dp(i,j)=min(dp(i+1,j+1),dp(i+1,j)+a[i+1]) else dp(i,j)=(dp(i+1,j)).

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

when will be the editorial released?

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

How to take random result in problem A ???

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

Can you explain the algorithm of C??

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

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

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

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