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

Автор drazil, 12 лет назад, По-английски

Hello, everyone! Codeforces Round #272 will be held at this local time. We're looking forward to your participation!

The problems are from dreamoon_love_AA and drazil(that's me) from Taiwan, and thanks 9mmlitswe for some discussion. Also we want to thank Zlobober and Gerald for helping us prepare the round, Delinur for translating the statement into Russian, and MikeMirzayanov for Codeforces and Polygon.

This is our first round on Codeforces, we hope you'll find it interesting! Please read all problem statements and discover what the main character dreamoon_love_AA do in those problems for he's really cute =)

Update1 Note this round will be held 1.5hrs earlier than usual Codeforces rounds, so please double check the starting time in your local time.

Update2 Score distribution!
Div2: 500-1500-1500-2000-2500
Div1: 500-1000-1500-2000-3000

Update3 The contests are over. Congratulations to the winners!

Div1:
1. Petr
2. qwer1561
3. kutengine
4. ifsmirnov
5. TankEngineer

Div2:
1. ridowan007
2. a00012025
3. xavier13540
4. v_Enhance
5. pkq2006

And standings are here:
Div1: standings
Div2: standings

Update4 Editorial can be found here. It's finished by now but it's welcome to tell me if anything can be improved!

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

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

After the rather lengthy round announcements of Round 271, Bayan Contest, Round 270, and Round 269, the age of short announcements are back. And what has dreamoon_love_AA been doing the past few contests? Trying to be another worse ?

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

Did Zlobober became a long-term problem tester as Gerald? Fact that he is no longer visible in contribution standings (as MikeMirzayanov :P) seems to confirm this.

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

I think you should write a warning about the unusual time of the round

Some people may miss the round if they didn't notice that.

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

I expect it will be a very Nice contest and contains various problem set
dreamoon_love_AA rank at UVA is 7 solved about 3205 problem this is his profile
http://uhunt.felix-halim.net/id/2397
I don't know other Online judges but being rank 7 on UVA is sufficient to see cool & various problem set

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

Damn. Bayan Qualification + Marathon24 + NEERC + Codeforces Round #272.

Because screw weekends

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

3000 point E problem come back! Do you guys want to make a super hard problem that is even harder than Chinese IOIer's round?

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

what a nice contest time :)

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

In the div2,the second problem is 1500,I dont't think it's easy.

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

I think a newly registered guy will be on top of Div.2 contest.

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

Found out that I don't have a pen at home 10 minutes before the contest. Going to use Paint instead of pen!

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

Oh I forgot registering contest.. :<

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

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

Goodbye red color :(

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

Who else failed A because of long overflow

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

how to solve B -div1 ??

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

92anurag was the first to ask.

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

Как С (div 2)/A (div 1) нужно было решать?

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

Explanation for problem C Div2?

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

I spend more time for problem C div 2, I am bad

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

tfw understood how to solve C at 30 sec before contest finish

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

Very interesting problems! Thanks to authors!

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

div 1 C без дерева отрезков\фенфика зайдет в ТЛ? Ясно что за |S|^2 находим отрезки из которых можно вырезать p, потом перебираем x, берем самые дешевые отрезки, которые не пересекаются, а потом нужно проверять пересечение и отмечать, можно ли делать это за линию?

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

How to solve Problem C Div 2 / problem A Div 1 ? i am trying to calculated with arithmetic sum formula Sn = (n/2) * ( 2*a + ( n - 1 ) * d ) , where n is the limit of the sequence . here is my code WA at test case 5 . can anyone please explain what is going wrong here .

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

This is my submission on A Div.1: 8203037

What is wrong with my expression?

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

solution of div2-E / div1-C someone please?

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

Первые 40 минут контеста решал задачу (и решил) с формулой

a * div(x,b)/mod(x,b) = k

Не знаю, чего здесь больше: моей глупости или плохо написанного условия. Но и то, и другое имеет место. Не надо так :(

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

I tryed to use long double (16 bytes in my gcc) and printf("%Ld",v) for "B" problem but not lucky at 1st test. double and "%f" passed 1st test, and "%.9f" passed all tests... I don't understand why "%Ld" not passed 1st test, where is my error?

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

C Fail system test on 26.... Yellow, here I come back!

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

Can anyone explain pretest 5 (input: 4 3) in problem C(div.2)?

Which numbers should be added?

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

    a = 4, b = 3

    Try for k = 1. We want div(x, 3) = mod(x, 3). Since mod(x, 3) = 1, 2, we thus have two numbers: one with div(x, 3) = mod(x, 3) = 1, and one with div(x, 3) = mod(x, 3) = 2. The numbers satisfying this are 4 and 8 respectively.

    Try for k = 2. We want div(x, 3) = 2·mod(x, 3). Since mod(x, 3) = 1, 2, we thus have two numbers: one with div(x, 3) = 2, mod(x, 3) = 1, and one with div(x, 3) = 4, mod(x, 3) = 2. The numbers satisfying this are 7 and 14 respectively.

    Trying for k = 3 gives 10, 20, and for k = 4 gives 13, 26.

    Adding them all gives the requested 4 + 8 + 7 + 14 + 10 + 20 + 13 + 26 = 102.

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

    Just write a brute force ....

    the numbers are : 4 7 8 10 13 14 20 26 sum = 102

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

Hello !

what's wrong with my code?! for div 2 C

http://mirror.codeforces.com/contest/476/submission/8197243

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

Hi!

I got a TLE on D, but I found out that my program ran exactly 2000ms on some case but the system gave me a TLE :(

Here's the submission link: http://mirror.codeforces.com/contest/477/submission/8206241

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

Changed

const int N = 2e3 + 2;

to

const int N = 2e3 + 3;

and my C passed ;__;. I'm such a loser ;_;.

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

How to solve div1-C?

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

    First you need to calculate nearest subsequence that match P and start from i for every i<s.size .

    Now we can use a simple dp, at each position we have 3 choices :

    1- you can skip this position to next one so : rec(pos+1, should_delete).

    2- you can delete this position if should_delete!=0 so : rec(pos+1, should_delete-1).

    3- if we have match from pos we can use this match, we have the ending position of this match (calculated in first step) so number of characters we need to delete so we can use this match is : end[pos]-pos+1-p.size . now if this number is less than or equal to should_delete then you can use this match so : 1+rec(end[pos]+1, should_delete-(end[pos]-pos+1-p.size)).

    The answer for each step is maximum of this three choices.

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

    First, let's calculate for each position i in string s value L[i] — minimum length of substring which ends in i and it is possible to get string p by removing some characters from it. It can be easy calculated using dynamic programming.

    Next, let's find dp[i][cut] — answer for prefix of s which ends in i and with cut character removes done. It can be calculated next way:

    dp[i][cut] = dp[i-1][cut];
    if (cut > 0) 
    	dp[i][cut] = max(dp[i][cut], dp[i-1][cut-1]);
    for (int k = L[i]; k <= cut + p.length(); ++k) 
    	dp[i][cut] = max(dp[i][cut], dp[i - k][cut - k + p.length()] + 1);
    

    This solution gives us O(|s|3) complexity. But you can notice that in every dp visited in the cycle difference between i - k and cut - k + p.length() is fixed: it is equal to i - cut - p.length(). So, you just need to use fenwick trees where in ftr[i + cut][i] you will update the answer.

    Then the cycle will look like this: dp[i][cut] = max(dp[i][cut], get(ftr[i - cut - p.length()], i - k) + 1); where get(a, b) function returning maximum on fenwick tree a prefix with length equal to b.

    Of course, you can examine my solution: 8203748

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

I read all the problems first time incorrectly. I figured first one after first wrong submission, figure second after frustrated by C which I made it too complex.

Btw problem was very good, lot to think less to code.

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

Last contest Bayan Warmup, my rank was 150, and top 50 won T-shirt.

This contest, my rank was 46, but top 50 didn't win T-shirt.

Why aren't there any T-shirt for each contest???

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

Today my contest is not so good at all, but feeling proud to see the participant ridowan007 of our country(Bangladesh) got rank 1 in Div-2. Really nice performance !!

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

Thank drazil for this interesting contest!

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

My submission for Div1-C got TLE, even though first inspection shows its complexity is O(|s|2 + |s||p|). Besides "use a faster language other than Python", is there anything in my code that can be improved?


My algorithm is to first find all "sufficiently close" subsequences of s that is equal to p (this is constructing the array found), by iterating over each character of s and p, taking note when the latest starting position of a subsequence of s ending with the character in p. Note that since any ending character is used only once, there are only |s| elements at most. Next, I used a DP with states of the form (latest found element considered, number of subsequences) (this is constructing the array dp).

At the end of this, I have an array of how many characters at least must be deleted to give a given number of subsequences (this is constructing the array dpres), which is easily converted to give the maximum number of subsequences possible by deleting a given number of characters (this is the first state of res; the second state just takes the minimum of the first state and the theoretical maximum number of subsequences with only having a certain number of characters).

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

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

Thanks for all the interesting problems.

I liked Div 2 C and B very much.I didn't come up with solution for A.Interesting and nice problem set.

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

In problem C div 1 (E div 2) occ(s',p) was a set of substrings. What does "substring" mean?

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

    A substring of another string S is a string of consecutive characters of S; in other words, it is formed from S by deleting some (including all and no) characters from the front and the back, but without deleting any character in-between the chosen characters. If S = abcd, then bc, ab, b, a, abcd, ε are substrings of S (ε is the empty string), but bd, abd, cb aren't.

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

I think there should be one more line in problem C Div.1. div(x,b)%mod(x,b)=0. This causes problem in understanding problem statement for a lot of participants.

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

    You mean C Div 2?

    Normally if division is written using mathematical typeset it is to be interpreted as real division. Besides, if the intention is floored division, it should have been div(div(x, b), mod(x, b)) = k instead, as the problem already defined div. And of course you can always ask the problem setter using the question asking feature.

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

    No. It was stressed that their quotient must be an integer (e.g. not real), which is sufficient.

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

I didn't understand prob C. Could someone please explain me this problem

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

(a + (a*b*(a+1)/2))*(b*(b-1)/2)

Prob C — Div 2 By using above formula why i am getting WA http://mirror.codeforces.com/contest/476/my#

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

Is there a bug with the rating? It looks weird ._.

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

I apologize for a re-post but i can't understand why this summation works for Div1-A/Div2-C ![ ](Image and video hosting by TinyPic)

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

hm...please tell me where is my mistake in div2b? (wrong test 11 after all formatting)

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

Div I problem E: an almost same but stronger version of this problem:

http://mirror.codeforces.com/gym/100162/problem/I

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

I'm trying to submit a solution to the Div2 E problem, but I'm repeatedly getting WA on the first test case itself, even though my code is giving correct answer for both the sample test cases on my machine. Here's one of my submissions for reference. TIA.