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

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

Привет, Codeforces!

Рад пригласить Вас на увлекательный (а мы постарались его сделать таким) Codeforces Round 734 (Div. 3) — раунд для третьего дивизиона, который состоится в 23.07.2021 17:35 (Московское время). Этот раунд — моя (MrPaul_TUser) первая "проба пера", и, разумеется, я бы не справился, делая его в одиночку — существенный вклад в создание раунда внесли MikeMirzayanov, BledDest и DK318.

Этот раунд содержит 6-7 задач. Задачи подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше, могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-часовая фаза открытых взломов. Мы постарались сделать приличные тесты — так же как и вы будем расстроены, если у многих попадают решения после окончания контеста.

Вам будет предложено 6-7 задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше. Независимо от того, являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Огромная благодарность WolfBlue, BlueDiamond, harlequen, -is-this-fft-, le.mur, Bench0310, Reiva5, Golovanov399 и Sho за помощь в тестировании раунда и улучшении задач.

Всем удачи и хорошего настроения!

UPD

Разбор задач

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

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

First time being unofficial :)

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

Now finally my exams are over. I can once again participate in contests.

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

Very glad to see another Div3 in small interval! good luck everyone!

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

Why is it showing registrations completed, does it mean I cant register for the contest now?

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

expert i'm coming

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

I appreciate that the testers are arranged such that their usernames' colors form a palindrome.

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

hope there will be strong pretests as last contest was ruined by weak pretests

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

"I tried to make strong tests — just like you will be upset if many solutions fail after the contest is over."

phew, unlike last contest ;)

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

see my profile I will never give div 3 I dont know how so many people solve so fast and ACM-ICPC rules sucks too.

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

Liked the thanking section!! where he used symmetric colour combinations.. :)

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

I registered for the contest before today's one (Specialist -> Expert) and it still says I'm in competition. Just to confirm this contest won't be rated for me right.

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

Hope pretest will be strong, not like last contest

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

Hi everyone,

I would like to know whether I can start 8 hours following the competition starting time since the starting time is past midnight for me. (I am new to competitive programming).

Thanks very much. Cheers

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

    No , if you give contest at later time than the mentioned time it wouldn't be considered for ratings . It will become a practice contest . For having yourself in official standings you must give contest at the mentioned time only then only you would be considered for standinds and rating change

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

    You can start a Virtual participation whenever you want after the contest but if you want to make your rating update you have to follow the starting time.

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

    I guess you cant participate later, but if you don't need rating, you always can participate virtual. It will be just like normal participation, but without rating. Cheers and good luck.

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

Now, finally before my exams, I am gonna compete.

And can anyone please spare a minute and tell me in which division do I belong, my rating being 814. Thanks.

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

Is there any chance of arranging these contests so they are in the evening or weekends. Anyone who has a job can't enter as they will be working.

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

If I know it early, I'll not get to expert:)

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

So we penalty of 10 min on the wrong submission and not of 50 points. Right?

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

Good Luck to Everyone

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

o sweet lords of coding, help me reach 1200.

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

Last minute tip ! Open this to side : CF Notifications So that you don't need to wait to see AC's

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

Last minute tip ! Open this to side : CF Notifications So that you don't need to wait to see AC's

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

After so long time i'm missing a CF rated contest for my Covid. :'( Hope to come back soon.keep me in your prayer. :(

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

Oof.

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +2 Проголосовать: не нравится
A,B1 == div 3 
B2,C.. == div 2 
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

A perfect div2 round.

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

A divison 2 contest with Divison 3 participants.

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

you should have said to check D2 before D1 instead of B2 before B1 I didn't get how dominoes are placed until i checked D2

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

Thanks for the great contest :)

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

lovely problems!

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

When can I check the testcases?

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

Problem C was incredibly similar to this problem, so much so that I copied over my solution almost verbatim...

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

Perhaps you should read the problem B2 before you start solving B1.

Was this meant to be a troll?

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

This round was too hard for Div. 3

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

Well I found that pretty tough and it wasn't even meant for me

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

    Solved all but D2. Why is problem D so hard?(or maybe I'm being dumb)

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

      I decided to focus on completing D2 instead and that deprived me of the time to attempt E or F. D2 was conceptually fine but the casework and construction is very fiddly.

      Even prior to that, B2 was fine but not Div 3 problem B fine.

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

        I implemented it by assigning different integers to each domino (so casework was on integers, without considering which letter should be used for which domino). Later I processed the integer table as follows:

        • create a graph of neighboring dominos IDs (so that we know which colors are forbidden — if two IDs are connected, we can't assign them the same color);
        • notice that no domino has more than 6 neighbors;
        • this means that you can simply select any color for your domino that is not yet assigned to any of your neighbors in the graph and you will never run out of letters;

        Submission 123498750 containing the color assignment at the end of st() function.

        Changing D1 into D2 took slightly less than 20 minutes.

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

          I did something pretty similar except it was just a row-by-row construction where I incremented a value (mod 26) while it matched any of its above or left neighbours.

          Not conceptually too difficult for sure, but with the different cases (N odd, M odd) I found it a pain, and the kind of implementation that isn't great for a 2 hour contest except for the most efficient coders. But I was too committed by that stage to stop and move on. I have since seen that E in particular was a much cleaner question and had I realised what D2 entailed I would have skipped and solved E.

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

            Makes a lot of sense, thanks for the reply ;)

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

            I did something to make the casework easier-

            We know at least one of n and m is even. So we have two cases-
            1. n(rows) is even
            2. n is odd => m(cols) must be even

            In case 2, we can rotate the table by 90 degrees => n and m are swapped, and all horizontal dominoes become vertical and vice versa, ie. in the rotated configuration, k becomes m*n/2-k. So we only need to solve for case 1, and that's it. (Oh, and we rotate the matrix back before printing)

            For filling the table, filling from left to right and from top to bottom at all times worked cleanly for me. (Had only to check the top, left, and bottom-left dominoes) submission

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

    I was chatting with other people at the same time so I didn't focus. But seriously I wasn't ready for this. Without turning on my brain before the contest, I just wanted to quit the moment I saw B and D.

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

someone please hack my submission.123523305

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

what is pretest 2 of B2 ? I was not able to figure out till the end

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

The problems were really interesting. Kudos to the authors involved! Would have been much better if this round was half an hour longer though

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

How to solve D1? I tried 3 cases. Got WA on Test 3.

Cases

Did I miss anything?

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

I submitted my solution with 22 seconds remaining. I couldnt see the verdict because the page was just loading. Now when i check in my submissions, there is no submission showing. And guess what, when i submitted it in practise it was accepted. Can i be helped??

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

B2 felt misplaced, for me B and D shoud have been swapped. Or C and B swapped. Or B, C, D reversed... whatever, I worked much to long on B2, and finally was not able to solve it.

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

How to solve B2?? I am not able to solve it

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

    I binary searched for the number of elements for each type and then reconstructed the coloring according to it. I think I overkilled it though.

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

      I don't see where binary search was required. I didn't think it was as difficult as the comments mention, but perhaps It was and I was just in form.

      I really liked problem $$$B2$$$, tbh.

      You can look up my code: 123477048

      Incase something isn't clear in the code you can ask me. But, mind you, I'm terrible at explaining.

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

    After having read the solution it is not very complecated.

    Consider f[i] to be the freq of i in a[].

    Then foreach f[i]>=k color the positions of the i in a[] with the k colors. Then put all other numbers in one big group and do the same in that group.

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

    Maintain count and position of each character in hash table, for example if array is 1 1 2 1, the count[1] = 3 and position[1] = 0 1 3.

    Create an array result filled with 0 of size n.

    Next iterate through each unique character in the hash table, now there are two cases:

    1. If count of any character >= k then that means you can paint each position containing that character with paints from 1..k, so iterate over position[character] from 0..k and fill each entry in result at position in incremental fashion, so result[ position[character][i] ] = i + 1

    2. If count of character is < k then push the positions of position[character] in an new array say leftPositions

    Now, at last, pop positions from leftPositions in size of k, and fill the popped positions in with paints ranging from 1..k, while popping in size of k, if at any time the size of leftPosition < k then stop and print result.

    Here is code to this approach: https://mirror.codeforces.com/contest/1551/submission/123471900

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

:(

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

    Why attend only virtual contest? I say, you should attend the on-going-contests as well, I suggest you not to care about ratings. Also, during the virtual contests you don't get that feel when you solve more problems than your level. Overall I say that its a different atmosphere when giving on-going-contests vs. virtual contests.

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

i got a WA on test 185 can anyone provide me with a counterexample 123529703

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

    Can you plz. elaborate your solution little bit more.

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

      The main idea is we partition the grid into as many 2x2 blocks as possible, with each 2x2 block being able to hold two horizontal or two vertical dominoes. If $$$n$$$ or $$$m$$$ are odd (only at most one of them can be per problem constraints), then we will have an extra strip on the end (the purple and brown region in the diagram). That extra strip can only be populated with dominoes in the same direction as the strip (so horizontal if the strip is horizontal, and vertical otherwise). Now, since we don't have as many letters as dominoes, we will have to reuse some, and I make sure two touching dominoes don't share the same letter by encoding same letters on diagonals, as shown in the diagram.

      I don't have the most rigorous proof for why this construction covers all cases, but the main idea is you have the wrong parity of $$$k$$$, then there's no way to evenly fill the grid without having a gap in the end that a domino of the opposite orientation cannot fill. On the other hand, if the parity is correct, this construction covers it.

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

You shouldn't make this contest so hard simply because DIV1/2 participants participate as well..

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

Isn't this output that my code generates for B2's sample input correct? Showing WA on test 1

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

why is this submission for E giving WA 123523281 on test case 5 I constructed a

$$$dp[i][j]$$$

whose states describe that we have arrived at i th point in the prefix with j moves done. To do that I first precalculate the

$$$pre[i][j]$$$

which says the number of elements in the suffix

$$$i,i+1,...,n$$$

such that the elements after the ith index (including i) have

$$$a[i]-(i-j)=0$$$

, i.e. we have done j moves and after that j moves the number of elements which are now standing at the required index. Now we can iterate over the moves done and check if

$$$dp[n][j] \gt =k$$$

and return the minimum j . please help if you can? The transitions are as follows

$$$dp[i][j]=max(dp[i-1][j],dp[i-1][j-1]+pre[i+1][j]-pre[i][j-1])$$$

second transition is as follows you deleted at the ith index. so

$$$pre[i+1][j]$$$

calculates the new sum that should be added now that we have made j moves and only the index after i is affected as the left shifts happen from these indices. Final number of elements which are equal given that we have made j moves are in

$$$dp[n][j]$$$

and now we can simply iterate over j from 1 to n

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

happy thing: accepted (during contest)

sad thing: accepted (1 minute after the contest)

worse thing: unfortunately, your solution of problem X has been hacked

worst thing: wrong answer/time limit exceeded in test set X (main test)

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

Did anyone solve D with DP ? I used dp on columns for each two columns c and c + 1 I may put [0, 1, 2, .., min(n, k)]

they will be placed greedily from top to bottom on column c and c + 1 and the remaining cells on c and c + 1 will contain only vertical dominos, if c == m — 1 i can only place vertical dominos on c;

I really don't know why this works, but I have intuition that when placing the horizontal dominos they can form some kind of connected block, and hence I can try different shapes for this CC

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

Is it only me Or B2 was harder for it's position?

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

In today's contest , problems were great but time was less and problems were more.

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

Trollforces

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

Two contests ago I reached expert so this was unrated for me, yet I was only able to solve A and B1. Clearly I still don't deserve my rating

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

Help needed! There is something wrong with my lambda expression below, but I have no idea why it turned out this, from my point of view, both a & b is in the range of [0, n), but it can be some invalid value, more exactly in this code, when n >= 17, it would be a mess. I would appreciate it if anyone could help!

#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int n; cin >> n;
        vector<int> sz(n), r(n);
        for (int i = 0; i < n; i++) {
            r[i] = i;
        }
            sort(r.begin(), r.end(), [&](int a, int b){
//                 cout << "a = " << a << " b = " << b << '\n';
                if (a < 0 || a >= n || b < 0 || b >= n) {
                    cout << "@" << a << ":" << b << ":" << n << '\n';
                    return false;
                 }
                return sz[a] <= sz[b];
            });
    }
    return 0;
}

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

Problem D2 reminded me of this problem if anyone wants to try.

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

Problem E was very similar (though not identical) to task from XIV Polish Olympiad in Informatics: statement in Polish

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

How are the multiple answers tested?, like in today's B2

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

Hi ! I encountered something weird in my submission for todays 'C'.

Firstly I have made a 'vector of vectors' which store the property of each string i.e. the number of a's,b,c,d,e. Then while checking for character 'a', I am sorting this 'vector of vectors' according to the difference between count of a's and rest of characters.

Driver code

But this is getting RTE in the comparator function:

Comparator

While Debugging for Test case 2, 2nd test.. I found that the size of 2nd vector passed in the comparator is coming out of be 0 at one stage (but all the vectors in my 'vector of vectors' are of size 5), and obviously RTE is generated there ..

Can somebody tell more about this ambiguous behaviour ? and how to correct it ( while using the comparator function only )

PS: In Comparator i have passed as vector<ll> &v1 only idk why it's showing vector&v1 here. Also my complete code is very ugly, so that's why am only putting snippets here !!

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

How are the multiple answers tested?, like in today's B2

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

How to solve C ?? I am not able to solve it.

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

    Let's define how interesting a given letter in a string as follows:

    • The number of occurrences of a given letter $$$-$$$ the number of occurrences without that letter. Let's call this value $$$x$$$.

    For example, in the string $$$bac$$$, $$$x_a$$$ would be $$$-1$$$ because $$$a$$$ occurs once and the number of non-$$$a$$$ letters is two. $$$1 - 2 = -1$$$.

    Another example is $$$aaada$$$, $$$x_a$$$ would be $$$3$$$ because $$$a$$$ occurs four times and the number of non-$$$a$$$ letters is one. $$$4 - 1 = 3$$$.

    We can find how interesting a given letter is for each letter $$$a, b, c, d, e$$$ and find the longest subsequence with a sum greater than $$$0$$$.

    This is equivalent to finding the longest subarray with a sum greater than zero when sorted.

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

Can problem A be solved using binary search?

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

can someone kindly tell me why am I getting a TLE in this code for problem B2 ? It will be very appreciated..thx 123532079

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

This is not the div.3 we wanted but this is what we needed.

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

Is there any way to get all test cases? My program for B2 constantly crashes on test 2 case 3901 and I have really no clue what's going wrong. 123544433

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

Can anybody helps me with my code in E it gives WA on test 4

code: https://mirror.codeforces.com/contest/1551/submission/123549241

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

Any ideas for F?

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

    If k = 2, you can pick any 2 nodes so answer is nC2. For k>2

    Let's say we can pick k nodes such that each node has a distance D with the other. Since all of these nodes are equidistant from each other, and the number of nodes is >=3, this has to be a star formation with one "unselected" node at the centre, and all the selected k nodes are equidistant from this centre (distance of D/2 to be precise, D can never be odd). Let's call the centre X. Let's root the tree at X.

    Also note that, any 2 selected nodes will have LCA equal to centre (meaning any path from one selected node to the other must go through centre, otherwise their distance will become shorter). What this means is that from the subtree of each child of X, only one node can be selected. If the number of children X has is <K , we can't select K nodes as the question states. If it has more children (C is the number of children X has) -

    Do dfs from each child of X and for a height h, let's say there are n1, n2, n3 ... nC nodes at height h in each child-subtree respectively. Since from each child-subtree, we can only select 1 node. The task becomes selecting K nodes (one from each child) given the above information. This can be done with dp.

    DP[a][b] means the number of ways we can select b such nodes (at max one from each child-subtree) from the first a children.
    
    DP[a][b] = DP[a-1][b] + na * DP[a-1][b-1]
    // Don't select a node from ath child + Select any 1 among the na nodes from the ath child.
    
    ans += DP[C][K]
    

    Looping over the root node X and height H and then solving the dp for each such combination yields the final result. You can look at my code, but my implementation is a bit messy with some extra code.

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

Finger crossed,for not to repeat last round hacking drama & to be specialist for the first time which missed yesterday due to hacking drama

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

Only 4 different characters are needed in D2: 123522856

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

editorial?

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

can anyone give hint for C. thanks in advance :)

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

Can someone kindly tell me why am I getting TLE in this code for problem B2? 123566277. I really don't know why it get TLE T_T

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

How long does it take to update the rating?

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

i must say this wasn't div3 contest , problem C was tough for me.

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

Thanks for Round!

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

To not keep you waiting, the ratings are updated preliminarily. In a few hours/days, I will remove cheaters and update the ratings again!

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

Спасибо за раунд!

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

Can anybody help in memoizing this recursive code for problem E since I get TLE: Problem E

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

please share hint for C.

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

please share hint for C.

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

Внимание!

Ваше решение 123450555 по задаче 1551A значительным образом совпадает с решениями других участников и находится в группе одинаковых решений rkarroy/123446796, oxxyumoron/123450555. Такое совпадение является явным нарушением правил. Отметим, что непреднамеренное утечка тоже является нарушением. Например, не следует пользоваться ideone.com с настройками по умолчанию (публичным доступом к вашему коду). Если вы имеете неоспоримые доказательства, что совпадение произошло по причине использования общего источника, опубликованного до соревнования, то напишите комментарий к посту о раунде со всеми деталями. Подробнее можно прочитать по ссылке http://mirror.codeforces.com/blog/entry/8790. Такое нарушение правил может являться основанием для блокировки вашего аккаунта или других штрафных санкций. В случае повторения нарушений, ваш аккаунт может быть заблокирован.

Здравствуйте! Я писала свой код на личном компьютере, в среде разработки. Возможно, решение совпало с чьим-то другим из-за своей простоты. Я ни с кем не общалась во время раунда, никому не отправляла код. Можно ли что-то сделать, чтобы такие ситуации больше не повторялись? Спасибо!