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

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

Привет, Codeforces!

Рады пригласить вас на Codeforces Round 773 (Div. 1) и Codeforces Round 773 (Div. 2), которые пройдут в 23.02.2022 13:10 (Московское время). Обратите внимание на нестандартное время начала! Раунд будет рейтинговым для обоих дивизионов. У вас будет 2 часа на решение 6 задач. Советуем прочитать все задачи.

Задачи основаны на олимпиаде RocketOlymp, и были придуманы и подготовлены __silaedr__, allvik66, alegsandyr, ilyakrasnovv и isaf27.

Большое спасибо

Участникам олимпиады категорически запрещается участвовать в раундах на Codeforces параллельно.

Удачи, высокого рейтинга и удовольствия от решения задач!

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

div2: $$$500 - 750 - 1250 - 2000 - 2000 - 2500$$$

div1: $$$500 - 1250 - 1250 - 1750 - 2250 - 3000$$$

UPD — Разбор

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

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

Notice the unusual time (returns back)

All the best everyone, may the force of positive delta be with you!

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

scoring distribution when

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

scoring distribution when

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

The unusual time strikes back. For once, I can skip my classes with an actually good reason for it.

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

As someone in the PST timezone, I cannot wait for this new experience of writing a contest at 2AM in the morning :D

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

today's codechef round is at the normal time of cf, so we have two rounds today.

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

By the way, this round is amazingly friendly for Japanese. Not only the round starts at 19:05 for Japanese but also Feb.23 is one of our national holiday! Thanks!

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

Score distribution?

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

Yay, waking up at 2 am on the West Coast will be so fun,

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

Can anyone tell me the what would be the rating of Yesterday's Edu C contest — Inc. Subarray sum ?? I want to practice such type of prblms

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

After the last round, I think I have a chance to get into Div. 1. But since the ratings haven't been updated yet, I can't register for Div. 1. Only an hour and a half left, do I just sit tight and wait? What happens if I register for Div. 2 now and then get promoted right before the contest starts?

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

Good luck and high rating!

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

Delay by 5 minutes

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

note 5 minutes delay

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

Delay 5 minutes ...

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

unfamiliar time, familiar delay. :(

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

Is it rated?

m1,m2,m3 do not load.

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

SpeeeeeedForces

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

Me wondering what to do after A,B,C

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

The difficulty gap between c and d was huge

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

Speedforces for sure

The gap between C and D is tremendous

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

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

Is it just me or some of the statements were kind of difficult to interpret?

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

why C<B<A<<<D ??

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

Specialists and pupils after solving A,B,C fast

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

Me after solving A-B-C in the first 20 minutes and not knowing what to do for the rest of the round ...

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

Figures in A are very huge , hope to be moderate next rounds

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

Really unbalanced contest, you have my heartfelt downvote.

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

E should be "cost" more. Its much harded than D (according to standings)

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

IMO, D has a very nice solution !

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

how to solve A?

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

    The answer would always be 0 if no side is parallel to the x axis. If a side is parallel to x axis , and the third point of the triangle that doesn't lie on that side is BELOW the parallel side , the answer would be the length of that side parallel to x axis.

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

      I did the same. Could you pls share your solution?

      • »
        »
        »
        »
        5 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +8 Проголосовать: не нравится
        pair<int, int> p[3];
        	for (int i = 0; i < 3; i++) {
        		cin >> p[i].first >> p[i].second;
        	}
        	if (p[0].second == p[1].second && p[0].second != 0 && p[2].second < p[0].second) {
        		cout << abs(p[1].first - p[0].first);
        	}
        	else if (p[1].second == p[2].second && p[1].second != 0 && p[0].second < p[1].second) {
        		cout << abs(p[1].first - p[2].first);
        	}
        	else if (p[0].second == p[2].second && p[0].second != 0 && p[1].second < p[0].second) {
        		cout << abs(p[0].first - p[2].first);
        	}
        	else {
        		cout << 0;
        	}
        	cout << line;
        
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Damn only able to solve Problem B...this contest is really unbalanced btw does anyone feels like problem A > problem B

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

Took me two minutes and a half to see the image of problem A !

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

Time limits in B and C. It was the last contest for me on Python. I'll go to learn c++.

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

D was next level adhoc.

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

.

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

What is the intended complexity of Div1D? I did N2^Mlog(2e9) and its TLEing :((((

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

I turned on the setting "show only trusted participants by default" in this round. It seems that for div2 this setting really removes a lot of suspicious participations.

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

I though that Div1 doesn't have cheaters, but it does: sol1 sol2

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

in DIV2C ,is there any need to sort the array or check whether a[I]%x==0 or not before finding a[I]*x in our map ?

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

Successful SpeedForces round, nothing else to say

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

too standard round

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

poggers sus amogus tokyo ghoul

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

Why is time limit for D1D so tight? My solution is $$$O(n2^m)$$$ but it runs for 1500ms even after optimizations, but some people's $$$O(n^2/w)$$$ solution runs under 500ms.


Another fun fact: I gave a problem using exactly the same idea as E in a Chinese OJ contest in Feburary 18th. However I lacked time so I didn't pass E :(

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

I wonder why someone would put 3 pictures with a total of 1.45M in Div2 A?

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

Can we please have the editorial ilyakrasnovv?

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

why many programmer pullout of contest without submitting any solution if first and second questions are tough or not easy to understand.

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

A and B weren't too interesting. I don't think A should be in div1 contest, B was not bad though.

C was similar to APIO 2012 Guard but not too much, I liked it. I wasted lots of time trying to find the similar problem tho :(.

D reminds me of USACO 2018 Cowpatibility, but I haven't thought much about it yet, solution is definitely very different.

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

https://codeforces.me/contest/1641/submission/147415490 Can someone explain why this solution for Div2C/Div1A got a TLE? Is there some quirk with unordered_map I don't know of?

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

Why are the TLs so tight? I wrote a $$$\mathcal{O}(n \log^2 n)$$$ parallel binary search solution to problem C, and it TLE'd. Had to use Van Embe Boas tree instead (147441626) to pass >_>

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

A statement was very confusing

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

I know how to solve problem D,but it's not easy to finish the code.

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

In problem B, at first I use vector to insert two integers, then I got TLE on 4. After I replaced vector by an array, I passed. Why can't you just enlarge the Time Limit so that those who use vector instead of array could pass?

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

The huge pictures in 2A slow down the loading of the page. The coordinates and sizes of the example triangles are not that large and there are extra space that could have been cropped out.

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

I'm almost certain this is unintended but I have a $$$O(\frac{N^2}{64}+N\sqrt{N})$$$ solution to d1D that passes pretests in under 500ms.

We just sort the arrays by $$$w$$$ then for each element, we just store a bitset of which arrays are incompatible with it.

Of course, storing $$$nm$$$ bitsets is too much memory, so let's only store it for elements which occur more than $$$\sqrt{N}$$$ times. So we need to add another $$$N\sqrt{N}$$$ to complexity to handle elements that occur small number of times, but it's fast.

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

I think Div.1 B shouldn't put at this place. It should be dressed with more confusing skins, added more strange limits, made impossible to code, and placed at Div.1 F. It is a great idea of mass destruction, Div.1 B is a waste of such a great idea.

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

Maybe this question is very strange. Why $$$n \leq 3 \times 10^5$$$ in question B but $$$n \leq 2 \times 10^5$$$ in question C? Different upper limits make me RE.

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

Why Tle on div2 B

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

Maybe there is a too big gap between problem div1.B and div1.C. But I think it's very good to make some challenges.

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

.. The pretests ....

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

trash pretest QAQ

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

I got TLE on both B and C for using unordered map while it got accepted when I replaced it with map :(.

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

Wow , You have strong pretest in Div2 C / Div1 A

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

I think the main idea of div1-D is similar to this problem(except parallel binary search): https://codeforces.me/problemset/problem/1285/F

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

DIdn't solve D cause of one line of code. I want to kill myself lol

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

This round is typically speedforces with weak pretests. (Div 2A is confusing and makes a lot of people quit, that's why so few contestants in div2)

When the difficulty gap between two problems are very large (like C and D in div2), then the ranking of contestant will depend on the speed that solve these easy problems. If you get stuck on one "easy" problem for a long time or make wrong submission, or failed the system test (the pretest of problem div2C is so weak), and you cannot solve hard problem, you will be finished.

Personally I don't like this kind of contest.

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

Hello guys ! Can someone explain to me why is that a normal set is faster than an unordered_set , the only operation i used on them is inserting elements and getting the size !!

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

I request all contest writers here that guys please make some strong pretests.You will get nothing by trolling participants.

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

ou yeah, another trash round, bad pretests C + no balance

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

A GOOD FST ROUND

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

Can someone suggest any test case where this gives WA (pretest aren't visible). Logic: For k = 1, answer is number of distinct power ups. The if minimum frequency element currently is 1 then it answer is same as for k-1.

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

Pretty fast systests!

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

Why are submissions still hidden ?

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

Good contest guys but I think you had weak tests for C. My submission https://codeforces.me/contest/1642/submission/147435078 is AC. I used a multiset with count. And I found out that count is actually really slow in multisets. So it shouldn't AC for the following example input. It should TLE.

1
200000
1 (100000 times) 2 (100000 times)
»
5 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +69 Проголосовать: не нравится

I solve Div1D with such a randomize:

for every element x we determine f(x) as a random number in 0...19

then for every i=1...n we will compute mask of the f of elements in the a_i

mask[i]=or(1<<f(x),x in a[i])

then we solve problem (find two non-intersected masks with minimal sum of weights) with subset DP

we repeat it 35 times,and take minimal of the answers

link:

https://pastebin.com/z03e8wU1

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

Has the system testing system changed?

It looked like it was rejudged several times even when it got TLE.

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

https://codeforces.me/contest/1642/submission/147449848 Can someone please explain why my submission exceeded the memory limit on test 10 for div2C/div1A ?

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

 Did anyone faced this problem too?The image was cropped for 8-10 mins in chrome.I changed to brave it was fine there.

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

147445279 why I got tle on B using unordered_map? please explain anyone

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

Hi there. I don't know where to ask general questions about solutions so I post them here. Pls tell me if it's a wrong place.

For both B & C I passed all the pretest cases, and failed with TLEs in the system tests. The original compiler I was using in the competition was C++17. After the competition I submitted the exactly same solutions with another compiler (C++14) and both of them passed all the tests.

Spoiler

It's my first time to encounter such a situation. It'd be very helpful if someone could tell me some general ideas to cope with this, like which compiler I shall choose by default during the contest. Since the pretests are all passed, it seemed impossible to see the difference during the contest.

Thanks in advance!

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

A slight modification for problem div2C/div1A —

If x is not known and we need to print both optimal x and minimum no of elements to add in array ,

What will be the best approach for this, ie with minimum time complexity?

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

bro wai C no have a[i]*x limit pretest

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

Can Anyone tell if my logic for Div2 B is correct or not .. Editorial and other solutions are not visible yet. Sorry for inconvenience.

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

problems rating(1000 , 900 , 800 , 2200)

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

How to solve div2D/div1B ?

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

    UPD:

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

problems rating be like(1000 , 900 , 800 , 2200)

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

When will the rating of Div.2 be updated?

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

I would suggest organizers use compressed images for problem statements. Heavy images increase problem statement download latency.

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

how do you miss such an important pretest on C bruh

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

tourist is one contest away to 4000 for the second time.

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

.

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

Problem C: Can any one please give me a testcase where not sorting the array gives wrong ans!

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

I think there is something wrong about rating in this contest, or because of the number of participants?

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

No editorial yet and submissions not yet public, are we preparing to repeat the contest? :)

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

During contest when I made submission for problem A, I got wrong answer. But when I submitted the same code after contest (link) with fixed and setprecision(12) before printing double I got it accepted. For the problem A, the answer would always be an integer. So why would it be incorrect when not using precision and fixed?

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

May I know how to solve Div1C?

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

    q * log(n)^2 solution:
    Maintain set of positions P that can be ill. For x = 0 queries you need to erase positions from P from l to r. If pos is not in set P answer is NO, otherwise answer is YES if there is some segment [l, r] with x = 1 with L < l <= pos <= r < R (L is maximal position < pos in P, R is minimal position > pos in P). You can solve this with maintaining set in segment tree vertices.

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

    You can just maintain a set of non intersecting segment of guaranteed 0, and set of segments with value 1 but without one segment entirly containing anouther, then to check if there is 1 in given position we can check if ther is a segement containing 1 and this point is the only non-zero one

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

I thought my code can pass problem C with time complexity O(nlogn), however, it exceeds time limits just at test3. Is there anyone who can help check my program? Thanks a lot.

multiset<long long> seq, del;
seq.clear(), del.clear();
for (int i = 0; i < n; i++) {
	long long a;
	scanf("%lld", &a);
	seq.insert(a);
}

for (multiset<long long>::iterator i = seq.begin(); i != seq.end(); i++) if (vis(*i)) {
	if (vis(*i * x)) {
		del.insert(*i);
		del.insert(*i * x);
	}
}
printf("%d\n", seq.size() - del.size());
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

How to solve Div1C?

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

[Deleted ...]

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

I'll admit it's quite careless of me not to realize C could overflow but one still would expect the pretests to have a case for that...

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

It's interesting for me to read that many people solved Div1D in $$$O(n 2^m \log)$$$ as both me and my friends found a solution with seemingly different complexities.

I choose a number $$$C$$$ (probably sth between 10 and 20 depending on the implementation) and randomly map each number to sth from the interval [0, C). If two sets of size m are disjoint then there is a positive probability that they will be mapped to disjoint sets as well (and if they are not disjoint, then they will be mapped to non-disjoint sets too). That prob is sth like $$$ \ge (\frac{C-m}{C})^m$$$, so if we repeat that, say, $$$8(\frac{C}{C-m})^m$$$ times then we have a good success probability. If all our numbers are from interval [0, C) then we can easily solve our problem in either $$$O(4^C)$$$ or $$$O(3^C)$$$ or $$$O(2^C \cdot C)$$$ time, what gives $$$O(8(\frac{C}{C-m})^m (n + 2^C \cdot C))$$$ solution. $$$C=2m$$$ kinda gives quite similar complexity, but setting C to 20 instead of 10 gives rather a better one.

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

    If all our numbers are from interval [0, C) then we can easily solve our problem in either O(4^C) or O(3^C) or O(2^C⋅C) time Can you please detail a bit about this ?

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

      You think of each set as a bitmask, there are only $$$2^C$$$ of them. For each mask you store the cheapest row that corresponded to it. By bruteforcing all pairs you get $$$O(4^C)$$$. However there are only $$$3^C$$$ pairs of masks that are disjoint and you are only interested in these and you can get such complexity by cleverly iterating through them. For $$$2^C \cdot C$$$ you compute a simple dp of form dp[x] = cheapest mask that is a submask of x in $$$2^C \cdot C$$$ and then if you have a mask $$$x$$$ you check it with $$$dp[(1 \lt \lt C)-1-x]$$$ (i.e. cheapest mask that is a submask of the complement of x).

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

My solution for prob A passes 136 test cases on Test 2 and fails the 137th. But I really have no idea why!

https://codeforces.me/contest/1641/submission/147497119

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

Good contest, finally I became Pupil. Thank you so much people!

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

Was Problem A more difficult than usual problem A of div 2? I was got 1 WA and solved after solving b c.

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

I'm a bit sad for ilyakrasnovv who gets a -94 negative contribution because of this post ....

Upd : Now -70 -> -66 (Upd 1) -> +80 (Upd 2)

Now I'm not sad !

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

I wonder Why do only few number of programmers gave this contest and why does this post has huge number dislikes ?any specific reason;-;

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

Why don't we have the an editorial yet?

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

The pretests are awful.It's to easy to FST.

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

    Different verdicts on main tests and pretests do be quite annoying, but you see, passing pretests does not always indicate that your solutions are absolutely correct. One may pay attention to details and boundary conditions and code more precisely, so that your program is strong enough and able to get rid of sticky FSTs.

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

Problem D and E is super great!

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

Even though I still can't get an accepted submission on div2 E/ div1 C, I really enjoyed the problem! Thanks setters!

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

147529502 question C , why is it giving TLE?

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

l

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

147428133 This is my submission from yesterday's educational round, here I have used unordered sets and it gave TLE on test case 6 but if I used a set in place of unordered it gets accepted. But since only insertion is executed how can it give TLE as far as I know, unordered sets have O(1) complexity while set uses O(log N) complexity.

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

codeforces? speedforces!