Hello, my dear Codeforcers!

Technocup is the olympiad for Russian-speaking highschool children. The winners will get significant benefits to enroll at Russian universities.

But it become open for everyone! Even if you are not a Russian-speaking highschool children, you can register for unofficial (out-of-olympiad) participation. The problems will be translated to English.

The contest starts on October 15, 09:05 (UTC). It will contain 6 problem to solve.

It will be rated round for:

- official Technocup participants
- unofficial participants from Div. 2

The contest will be hosted according Codeforcers rules.

**UPD 1:** The scoring is 1000-1000-1500-1500-2500-3000.

Would the problems be in English ?

They will be in Russian and in English.

Ok,Thanks

3 Div.2 only Contests in 3 Days O_O

Bad luck for Bangladeshi contestants ! We will miss it, because we have ACM-ICPC Preliminary Contest starting at the same time (3:00 PM UTC+6) today! Missing a CF round is very painful to me. But wish to participate in this round virtually, as there is no alternative.

I'm sure you will survive! ;)

What will be the difficulty of the problems like?

Almost missed this round since there was no notification yesterday. hope I won't do so bad at this very unusual time.

unusual round with unusual time

Rated ?

only for div2

I am new here.How much rating is div1/div2?

div2 ]-INF,1900[

div1 [1900,+INF[

Thanks.

Thanks

Looks like there'll be no trivial problems :

1000-1000-1500-1500-2500-3000I am really happy because we have so many rounds in few days. Thanks !

But when I saw in description of the task that is interactive + looked at inputs in the second and fourth problem, my wish for doing round dissapeared :(

I've got my D running on pretest 3 for about ten minutes

Can anybody tell me what's wrong with this?

What was pretest 4 on problem B?

I think something like:

a0.50a0.50

answer is just 1, you shouldn't print 1.00

I am sure this is not the pretest since my code accounts for this

Maybe a999.999b0.01c0.99?

This is not it either

for me , a case when answer is 1 not 1.00 worked for getting past test case 4 .

well, in this kind of problems you never know where the WA comes from :(

how about a13.523.532.01b0.98c0.01

I got this pretest working after I changed int to long long. This stupid mistake took so much time and score from me...

I did the same mistake and I didn't get blue because of that :C Well better luck next time :D

Problem B was unusually horrible ;[

Even #passed C is greater than #passed B...

I Agree, but for some reason I thought it was easier than A and thus tried to solve it first.

Is D completely greedy?

Yep!

matching problem but can be solved greedy

N=1e5 so greedy is safer to code

<_< I stupidly forgot about the bound that preference will be adjacent sizes so I actually did max flow. You only need ~50 nodes for your max flow though, because you can group together people with the same preference specification.

I struggled for quite a time but still couldn't understand the greedy algorithm. I am more stupid as I didn't notice the "neighboring" constraint until reading you comment T_T

How do we construct a network small enough for a flow algorithm to pass the time limit?

Problem E Pretest 5:Anti Hash?

Do you pass this test:

Seems like i have tendency to miss the statement given in bolds.

I dont know the answer to problem D. please tell me the approach. I thought it like putting shirts which are sure over and over again.

And after the contest I read prob F, and is it greedy???

i used dp but did not code it

Sort the people by their tshirt choices sizes . Say you want to assign x "S" tshirts , you greedily assign them to people with only one choice . If you cant the answer is NO . Next assign tshirts to people with one of the choices as "S" . After that remove "S" from the choices of people who havent been assigned any tshirt yet . Similarly for other tshirt sizes .

Problem D: assign T-shirts for participants with only one size first. Then sort the remaining participants by size, always try to give them a smaller T-shirt if possible, bigger one otherwise. If any of the counts for remaining T-shirts in negative, print "NO".

a sample code please?

&& and also is F greedy?

Sorry, I couldn't solve F.

My C# Code for D (as submitted, added some comments):

CodeWhy is this correct?

You can't do anything wrong in this step, so it should be obvious, that this is correct.

I should clarify, that I start with the contestants having the smallest size. So, if I have T-shirt S and M (one each), participants S/M and M/L, then I assign the S T-shirt to the S/M participant. If I would not do that, noone else would have use for the T-shirt. So, if I assign it in this step, I can't break anything. There might be some more participants with the same size, but not enough T-shirts of the lower size, so these get a larger one (if they wouldn't, there would be no way to give them any T-shirt). Now we have handled all participants with the smallest size. We can go one with the next bigger size, that works in the same way as the previous one.

That means, that I assigned more T-shirts of a size than possible. That obvoisly doesn't work.

One could solve that problem with a max-flow algorithm too, but it would be quite overkill.

Well, that's good enough to me... Thanks!

One more question: how do we construct a flow network small enough to Edmonds-Karp fit the time limit?

The graph is actually quite small: you have vertices for each T-shirt size as well as each participant type (2*sizes-1 types here). Two more vertices (source and sink), that's all. The edges are the capacities (from source to participant: count of participants of that type, from t-shirt to sink: count of t-shirts). Numbers are random, change them depending on the testcase:

I hate tasks like B . C and D were way easier . I wish I'd read D before B :(

B took lot of time. F was not that hard either. I needed some more time for F.

How to solve E ?? without hashing

Aho–Corasick algorithm

can you please explain your approach ?

I haven't coded it yet, but it should be something like this.

This should be O(n*k + g*k), which is guaranteed to be about O(1e6 to 1e7) and fits into the 4s TL easily.

UPD: My implementation: http://codeforces.com/contest/727/submission/21471422, remember to handle repated usage of a certain name.

Maybe Suffix-Array. Use Binary-Search to match all the names of the game to the string on the CD. Then find some positions which can make the string on the CD filled by these names.

I did that stupid mistake str.size() — 3 and leading to integer underflow issue.

But can anyone explain why this happens? is integer underflow also compiler dependent? o.O This code http://ideone.com/QU5GRm doesn't work as on ideone on my system?

This is unsigned integer (not unsigned int though) overflow, meaning that it is defined. The thing is that string::size() is of type size_t which depends on the platform. On your computer it is stored in 64 bits, on ideone it is stored in 32 bits — http://stackoverflow.com/questions/1119370/where-do-i-find-the-definition-of-size-t.

Thanks i get it now. The value 184467440.. also overflows when assigned to (signed) long leading to negative value -1 in my system.

str.size() returns an unsigned integer. Always use (int)str.size().

This might helpFunny Bug

Approach for problem D?

http://codeforces.com/blog/entry/47759?#comment-320501

F hack test:

Answer: 1

Any ideas why one could get WA50 on E?

Assuming you're using a hash-based solution, I think that test case makes a bunch of games' hashes collide, so that if you try to keep a map "hash -> game", it won't work: this would have to be a multimap, since several games can hash to the same value. To solve this problem, I used two different hash functions.

What's the intended complexity for F?

We have proven complexity and unproven

O(m+n^{2}).Isn't my

O(n^{2}+m) DP trivial (and trivial to prove correctness)?Maybe I'm missing something?

Edit: I have missed factor so the correct complexity of my implementation is . (integer sorting can be used to get

O(n^{2}+m) (under reasonable bounds of values and on a reasonable model), though).It is great. Please write it!

dp(i, r) is the minimum possible non-negative value you can start with at position i and go till position n, removing at most r elements, such that the value never drops below 0. Complexity of this step is O(n^2).

For a given query b, you can use binary search on the number of elements r you need to remove, using dp(1, r). I have used 1-indexing. Complexity of this step is O(m*logn).

Total complexity is O(n^2 + m*logn).

Code

Using a greedy algorithm, the complexity will be O(n^2 * log n * log m), which also gets accepted. 21472657

Rating changes for unofficial Div2 participants ?

Problem D: http://codeforces.com/contest/727/submission/21454057 when i run same code on my system i am getting correct output :(

check ur ans on online ide. here

Anyone else cannot find their name in the standings although they participated?

Are you sure you are checking the unofficial standings?

Mark the checkbox "Show unofficial".

WTF !!!

This is bullshit , where's the rating change for div2 !!!!!

That feel when you fail the round but still improve your rating and become blue. https://www.youtube.com/watch?v=BinWA0EenDY

.

Waiting for div. 2 rating changes!

Is the rating updated? I'm from div.2 and was not rated.

Me too...

is the round gonna be rated for Unofficial Div.2

I am an unofficial div 2 participant and my rating stays the same after rating change. Can someone explain?

for all unofficial div.2 participants still doesn't change.

I think rating change in this round will be in two part for us and for officially participants separately.

That's a common problem for DIV2 unofficial participants

It will be updated soon.

thanks for clearing!

Hi. Could someone please clarify who will have ratings changes for this round? It appears that all those who were official participants have had ratings changes, unlike what was said — that it will be rated for div 2 and official participants are Russian school students. If it is clarified, it will be great!

This is the best comment I read :D

What about the editorials ? there will be editorials like regular CF rounds ?

Of course, there were editorials for the previous Technocup.

Rating changes are weird for unofficial participants . In usual rounds any rank < 300 fetched me a positive rating change , today even a rank of 177 fetched me negative change o.O

That's because number of users were much lesser today.

In problem D, flow worked. Constraints were not tight.

Do you mean to say that the test cases are weak. Or your algorithm worked in linear time? As far as I know max flow works in O(E*V^2).

Why didn't I get any rating changes? (I registered during the contest)

the same here

Do you registered during the contest as well?

My rating hasn't changed 1 hour ago, but now it has changed . Sorry for my sorry English.

Still didn't get any rating update.

yes

Achievement unlocked! Gotta change my handle now!

I was so close to rain on your parade :D

The same way you were so close not to be so close "to rain on my parade" :D

I see that some div2 participants have their rating changed after the contest. But still no change for me :( ?

same here.

Thats weird.

I thought that with other div2 participants my rating will also be updated but it didn't happen.

where is the editorial ?

problem E. I have written hash as described here but failed on 14 test. What is wrong? It is not good approach here or should I search bag in my code?

Is there any python solution passed for D ? my Python code got TLE, it's frustrating when you have to rewrite the same code with another language to get accepted.

Would someone mind help take a look at this code for Div2F? It seems to over-estimates the answer but I don't know why.

http://codeforces.com/contest/727/submission/21475250

Logic: Solve the queries offline, answer them in non-increasing oreder as the solutions are monotonic. Always keep the minimum prefix sum, whenever the guessed mood is not sufficient to compensate the prefix sum, keep removing the worst quality question from the array and increase the counter by one.

Removing the worst isn't optimal. We should remove the one that maximizes the minimum of new prefix sum.

When will the editorial be posted?

It is already posted (and translated, as the Russian version was available before the English one)

http://codeforces.com/blog/entry/47773

How did u know that it was posted ? I log in daily and didn't notice it in "Recent actions" section !

I guess it was posted in recent actions, though I am learning Russian and sometimes I go to Russian version of the website (maybe it was only posted there and then I changed the language to English — as I know less Russian than a 5 year old kid. I don't know how blogposts work, but I saw it in recent actions).

:(

tfw you misread the problem statement and overthought it.

YES, i realized it :(

If someone have missed editorial, it is there.

Would it be a rated contest?

We are planning to run TechnoCup Elimination 2 as rated contest for at least D2.