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

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

Всем привет!

Лето... Прекрасная пора для поездок на отдых, прогулок с друзьями, новых открытий и, конечно же, написания новых увлекательных контестов на Codeforces. Поэтому, я предлагаю к вашему вниманию мой новый Codeforces Round #495 (Div. 2) с интересными задачами и не менее интересными разборами, который состоится в 05.07.2018 19:35 (Московское время). Если ваш рейтинг меньше 2100, этот раунд будет для вас рейтинговым, иначе — вы можете участвовать вне конкурса.

Хочу поблагодарить Михаила MikeMirzayanov Мирзаянова за помощь в подготовке и за системы Codeforces и Polygon. Также Ильдара 300iq Гайнуллина, Дмитрия cdkrot Саютина, Даниила danya.smelskiy Смельского, Chin-Chia eddy1021 Hsu и Kevin ksun48 Sun за тестирование задач.

Вам будет представлено 6 задач и 2 часа на их решение. Разбалловка будет объявлена ближе к началу раунда.

В этом раунде вам предстоит помочь девочке Соне с ее ежедневными проблемами. Удачи вам в этом!

UPD. Разбалловка 500-1000-1500-2000-2500-3000.

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

Место Ник Баллы
1 EZ_fwtt08 7892
2 milisav 5550
3 VisJiao 5294
4 Jatana 4832
5 wasyl 4762
  • Проголосовать: нравится
  • +379
  • Проголосовать: не нравится

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

June 5?? Please correct the date, it's JULY 5!

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

June 5?? Please correct the date, it's JULY 5.

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

I think this is the shortest, precise and most exciting round announcement I have ever read.I hope the problem statements are along the same lines.

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

Hope that we wouldn't see number 502 with label "Bad gateway" again)

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

Is it rated??????

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

Rating is like life . Full of up and down down down down down down down .

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

Thank you for this announcement on the glorious Fourth of July. I hope my rating goes to 1776 after contest. For America, her allies, and my constitutional right to shitpost. #AMERICANUMBERONE

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

Unimaginably, they've mentioned Mike.

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

One more task and this would have been a beautiful regular round with two divisions.

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

+1 if you want problems to be short and concise instead of long confusing stories...

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -38 Проголосовать: не нравится
  1. Seeing so many grey comments under the announcement...
  2. Summing the number of downvotes and upvotes of the comments.
  3. Getting -10 per comment in average.
  4. Trying to find out what's wrong with comments.
  5. Understanding that GooglerPraveen said the genius thing: http://codeforces.me/blog/entry/59942?#comment-436969.
»
8 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

kun? Another Mathforces round?

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

I hope codeforces work properly today.

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

Where is KAN for help to prepare the round.

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

I smell math for this round either

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

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

What to do if you don't meet Wael.Al.Jamal in comments and can't downvote all his comments for reaching the new record (-200 contribution)? EXACTLY! You must help Codeforces community to reach another record — the greatest total number of downvotes under the announcement in the history.

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

arsijo, Is she the same Sonya from Codeforces Round #371 ..??

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

Again my rating will decrease.........Why there is no rank name under newbie....?

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

I've noticed in the previous two Div 3 only rounds the registrations exceeded 8000 at both times and Div 2 contests don't often get that many participants. I wonder why

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

Rating is like life . Full of up and down down down down down down down .

see my graph

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

Problems are loading very slow. Is it just me?

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

#define int long long

Are you serious?

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

Congratulations to Codeforces with 40,000,000 sent solutions!

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

Am I the only one who is not able to submit the solution for problem C

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

A very uneven contest. Problem C has 2k+ solutions, and problem D has less than 100. Codeforces needs to work on the aspect of balancing the problems evenly.

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

A easy B easy C easy then suddenly D hard? Nice diff spread

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

very confusing statement

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

Attempting Problem D after successfully submitting Problem C:

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

Простите, но это было очень скучно, т.к. проблемы D и E остановили почти всех, а A B C были достаточно простые.

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

Was it just a bad day for me or there was seriously something weird with problem A? -_-

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

Wow, D was pretty tough for me...Can anyone provide a solution? My only thought was to simulate different possibilities with BFS and use heuristics to lower the search space, but I still timed out.

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

How to solve B? I didn't get any idea

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

What was Pretest 4 in D?

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

How could so many people solve B? Is there anything I didn't keep in mind?

Also, F seems to based on sqrt-decomposition approach, doesn't it?

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

how to solve C

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

For this contest will have to say don't think too much.

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

What could be testcase 4 of D ?

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

Does the solution to E involve finding the Centroid of the tree? (Centroid in terms of the distance, not in terms of the number of nodes)

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

Too long statements. Surprised with the problem B.

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

I had one interesting idea for E which I want to share, I am really curious will it pass all testcases. I think I have a little strange background of my solution, so it possible I have bug. Anyway here is idea with randomisation:

In case we know one node in the result path, we will always go in subtree which contains furthest node from that node ( if we have two ends, we will choose node with 'better; subtree...)

Now if k < const and diametaroftree < const we can explore paths from each node and calculate best result. Otherwise we can choose const random nodes, investigate them in O(k) and choose best result. For const near 1000 , probability for mistake should be really small.

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

What was the solution for F?

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

How did you solve Div 2 D ?

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

Is there a reasonably short way to solve D? My idea was to watch the growth of the sequence of counts of different numbers, predicting what the next number should be assuming that the corresponding rhombus does not hit the edge of the matrix. Then, if the prediction turns out to be wrong (the actual count is lower than the expected one), consider the different cases of edge positions. But those predictions and subsequent pattern matching have tons of corner cases and are ridiculously tedious to implement.

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

For those who passed D with >1000ms. Try test n = 840, m = 858, cx = random(1, n), cy = random(1, m).

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

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

what the hell is testcase 4 in D..!!Can't debug..

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

Чето в последнее время див 3 это див 2, див 2 это див 1, а див 1 это тоже див 1, но с еще более плохими задачами.

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

My ratings to me after not solving B. :(

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

Can we solve E by choosing K consecutive segment of nodes in the largest path of tree? Like sliding a window of size K

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

Did anyone actually solve problem B with a solution different from "01010101..."? That would be hilarious.

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

Unhackable round ! xd

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

A quick system test considering the number of participants and even quicker ratings update.

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

Why is this code getting TLE in test 52 in problem E? 40007267

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

legendary speed system test and rating update

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

elijahqi was 4th in standings. After system tests, he is not in the rankings at all. what happened here?

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

Why are long and int of the same limits on the compiler used in Codeforces? In other websites long has wider range than int and equal range as that of long long.

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

Why the answer of problem E for the second sample is 7 and not 6?

If the shops are in : 3, 4, 5.

The minimum distance of node i to any shop is:

Junction 1: Shop 4 — Minimum distance is 6

Junction 2: Shop 3 — Minimum distance is 6

Junction 3: It is a shop — Minimum distance is 0

Junction 4: It is a shop — Minimum distance is 0

Junction 5: It is a shop — Minimum distance is 0

Junction 6: Shop 4 — Minimum distance is 6

Junction 7: Shop 5 — Minimum distance is 2

Junction 8: Shop 3 — Minimum distance is 1

Junction 9: Shop 4 — Minimum distance is 6

Junction 10: Shop 4 — Minimum distance 5

In this way, the answer is 6, isn't it? What is wrong in this solution?

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

Problem B was kind of a one-shot problem. You need to wait till you realise the answer is alternating zeros and ones.

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

easy problems B, C

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

how to solve problem D?

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

Can anyone explain me, why one submission gets AC, and other TL4, they seem to have near the same complexity and idea?

AC code — http://codeforces.me/contest/1004/submission/40000703 My code(TL) — http://codeforces.me/contest/1004/submission/40004156

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

I think there was a mistake in my source code for problem A. But my solution got accepted. Here is the link to my solution: http://codeforces.me/contest/1004/submission/40001844 If i input 4 as hotel number and 2 as difference and 1 2 4 and 40 as the hotel locations,should there not be all locations in between 6 and 38 and the additional 2 locations for two ends? i think my solution did not cover this part. I hope it can be checked and clarified. Thanks

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

test9 on problemE is so danteng

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

I'm surprised rating change was given in just about one hour. Thanks to the Codeforces team for reducing the waiting time.

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

I'm surprised the rating change was shown in just about one hour after contest end. Thank you to the Codeforces team for reducing the waiting time. Hope to see this improvement in future contests!

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

When you skip B because you have no idea of the right greedy strategy, spend 1h30 on D and at the 1h55 mark understand what B was really asking for...

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

I'm not gonna say this contest is bad because I'm always grateful when there is a new contest, but the problems' difficulty distribution makes no sense: A, B, and C were all the same difficulty (actually A is probably the hardest). It doesn't even test programming skill, just write fast and pray there aren't any bugs and you get +100 rating.

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

how to solve A?

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

Problem F is very similar to COCI 2017/18 Round 2, last problem (link to the codeforces blog). The difference is that that there we want the number of ranges with gcd(A[L;R]) = 1, but the same idea will pass (you can look at the comments).

So if anyone doesn't want to wait the editorial, he can check it out.

Link to my code for that problem.

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

Am I the only one who thought about Codeforces Round 439 (Div. 2) and people, who solved B and C but did't solve A which was even more funny than today's B?

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

    I was stuck on A as well. I was really sad that I couldn't even solve A in a contest was thinking of leaving the contest but then saw B and faith were restored. I solved A with a time penalty of 110 (around) points and 150 points attempt penalty.

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

Your crafting.oj.uz ratings are updated!

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

I think pC should replace pA and there should be another pC which reduces the gap between pC and pD. I don't know why contestant are calling pB troll problem because it was nice simple problem. I don't like pA and pC(as C). Also this was my first contest and I learned that "Implementation is a part of competition and it should be a part of preparation".

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

I was able to solve problems A and B but not the problem C. I know it is quite easy. But I somehow couldn't explain myself the logic in my mind. All I could think was of a prefix array will the ith index in it denoting the no. of the unique elements to the left of it in the array. Can someone explain the solution to C? It can be short too, I kind of have a rough idea after looking at the codes of other participants who used sets and maps for the same.

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

I face a problem with Pypy on CF.

I got RE with exit code is 13131313 if I import random library. The same code is AC with python

http://codeforces.me/contest/1004/submission/40007659 — AC with pypy3. http://codeforces.me/contest/1004/submission/40007677 — RE with pypy3 because of import random. Exit code is 13131313 http://codeforces.me/contest/1004/submission/40018157 — AC with python3, (has import random also).

Any help?

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

After 2 years of python I forgot that I have to use long long instead of long. :-D good bye good rating.

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

I suppose I have a relatively easy way to solve D. First of all, let d be the distance from zero to the nearest side of the rectangle. Then we can find it as following: numbers 1, 2,... d must occur exactly 4, 8,... 4*d times, while d+ 1 will occur less then 4*(d+1)

Next, notice that the max numbers is the distance to the furthest corner. Now check all pairs (m, n) such that mn=area. Notice that we can find position of zero By distance from nearest rectangle side and distance from furthest corner. Now simply check if that position is ok (I had a special function for checking if specific m, n, x, y were ok. That's it

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

Editorials are not here....

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

can anyone help me with problem C

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

guys can anyone help me with problem C because in that problem i m getting a TLE but still after going through the editorial also i m unable to figure it out...........PLz help

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

Почему в Е нельзя взять позицию, с минимум из максимумов дистанций, затем жадно брать вершину с наибольшей оставшейся дистанцией (k-1) раз?

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

101010101 = LOLOLOLOL

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

Editorial here...

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

разбора не будет?

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

Can anyone tell me what is wrong with this submission? http://codeforces.me/contest/1004/submission/40022548