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

Автор Vladosiya, история, 4 года назад, По-русски

Привет! В 02.03.2023 17:35 (Московское время) начнётся Codeforces Round 855 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6-8 задач, которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

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

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

Штраф за неверную попытку в этом раунде будет равняться 10 минутам.

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

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

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацией нашей работы. Задачи были придуманы и написаны командой Университета ИТМО: MikeMirzayanov, myav, Aris, Gornak40, ibraevdmitriy и Vladosiya.

Также большое спасибо: tolbi, lunchbox, Son, sary, Wibo, yorky, nigus, tute7627, 74TrAkToR, bigfoot19982, oversolver, Be_dos, CARBINE, molney, KoT_OsKaR, Nickir, cutehater, Crutch, vrintle, Rubikun, akulenok, medk, Jostic11, Ghassane за тестирование раунда и весьма полезные замечания. Список тестеров будет пополняться.

Всем удачи!

UPD: Разбор

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

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

I became expert for the first time around an year ago. But never got a chance to participate in an unrated div 3 contest. So this is my first unrated div 3.

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

This div3 round will be the 1800th contest of Codeforces. Congratulations!

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

....

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

"do not have a point of 1600 or higher in the rating"?

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

Whis the last two problems of the contest will be interesting.

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

looking forward to be pupil finallyy pls

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

Hope so I reach pupil this time. :-)

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

My birthday contest! I hope I can become expert. Edit: lol I'm dropping a lot

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

I hope being specialist after this round

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

вот блин,почему раунды див3 рейт только для людей с рейтингом меньше 1600(

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

Apparently I probably get negative delta in the last div 2 round which will put me back to specialist.

If my rating isn't update soon will this round be unrated for me ?

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

Div.3 is perfect for my first rated contest.
Looking forward to a good rating.

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

First time to test a codeforces round, The problems are nice, I recommend everyone to participate, have fun and prepare your cats!

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

muchas gracias aficiónados esto para vosotros SIUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

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

Круто! Всем удачи на предстоящем 3-ем Диве. Теперь ждём Див. 4)))

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

This will be my first div 3 contest I'm so excited

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

There was no Div-3 round in the last month :(. And problems are getting harder nowadays :(.

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

As a tester, Worst Contest I Have Ever Seen!..

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

hope a big postive delta I want to rank up to be Specialist:)

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

this time div3 contest will not be rated for me. Mixed feelings

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

I hope every participant to get + points and do well today <3.

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

i will hack you

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

I have to say it... drumroll.. stringforces

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

lets become pupil

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

StringForces

»
4 года назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится
POV: you got WA in problem A
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think first prob should be like: "the string can only contain the letters 'm', 'y', 'a' and 'v' ..."

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

never thought a day will come that I'll hate strings and string algos.

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

it's sad that I wasted too much time on D due to a small mistake again :(

I can't reach expert now.

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

the worst round of my life...

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

Great Contest!

Enjoyed solving a bunch of problems, Finally back to specialist again :D !

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

A great Div 3 as always. My best ever contest performance.

A: Pretty trivial, just remove duplicates

B: Process all the good pairs, then for letters with >= 2 occurrences use a k to make them good.

C: Standard priority queue, I took a risk and didn't prove it however. (also got a penalty because I forgot to use long long >.<)

D: Another solution I didn't prove, but I used memoization and checking for !memo[i][s[i]+2] to increment answer

E: I did casework for the easy version, then generalized it for the hard version.

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

How to solve F?

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

    I'm getting WA3, but I still hope the direction is right, correct me if it's wrong;

    I came to using https://www.geeksforgeeks.org/count-pairs-given-xor/ so 25 unique characters, for each word, we go from a character 'a' to 'z' and set 1 if the number of occurrences of a character in the word is odd, and set 0 otherwise.

    then we try to exclude every character from 'a' to 'z' and consider all other 25 characters, we said that each character should occur an odd number of times, in binary it's all 1s, so we count the number of pairs with xor equal to all 1's

    but getting wa3

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

    You can Use bit manipulation with DP.
    See you have N strings. For each string count the number of all characters present them if all the characters from 'a' to 'z' is present in the string than this string is of no use for us.
    So we consider all the strings where unique characters are less than 26. For each string we will create a val initially with 0. If some character x comes odd times than we will add (1<<(x-'a')) to val. Now we can use a DP of say type like this
    vector<unordered_map<int, int>> dp(128). For each character ch not present in the current string we will increase the value of dp[ch][val] by 1.
    As the number of strings are 2*10^5 the number of values are also can be at max 2*10^5. Now similarly for each string again we will check for all the characters that are not present in the string we will consider them not present in the second string as well and for remaining characters if some character is present odd number of times in current string than it should be present even number of time in other string and vice versa.
    This way we get a value same way we calculated while creating the DP. For that value and absent character we will add that value to our answer.
    At the end for each string we had added each value twice. So print ans/2.

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

Nice Div. 4 Contest

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

Is it possible to calculate the hash when swapping one character with another? I used the polynomial rolling hash algorithm, but my code fails on Test #5 in Problem D, not sure what exactly that I did was wrong. Can someone give me a clue why my intuition was wrong?

Submission

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

    I guess it's because of the anti-hash testcases, made to elevate the probability of collisions. And I couldn't find a way to use two different hashes for the computation.

    Gave this question a 15 min thought and realized it's just observation and 3-5 lines of code.

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

How to solve D?

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

Wasted 30 minutes in D because I thought hashing would work..

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

Girl in a jacket .

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

stringforces

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

i think it was nice for speedrunners

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

In problem $$$E2$$$ why $$$k$$$ may be larger than $$$n$$$ !?

I wasted 15 minutes because of that (I assumed that $$$k≤n$$$), and I'm sure many people failed because of that case.

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

Nice problems like always. orz ITMO University team

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится
  1. bad testcases of problem A.
  2. see my this solution is 195584757 wrong for mmeo but it's still accepted
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Nice round with a variety of themes!

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

how can i optimized this solution for problem E1 https://codeforces.me/contest/1800/submission/195690945 I have used brute force approach to check

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

    There are two types of letter positions:

    • unreachable by any swap (eg. third in 5-letter word)

    • possible to do a swap with some other letter

    So for the first category they have to be the same, position-by-position (as they cannot be swapped). For the second category only total number of each letter must match — because they can be permuted in every possible way (I didn't prove it formally, but just assumed and it worked). There was no need of finding the chain of swaps leading to correct one

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

here answer me how WE COULD SOLVE THE PROBLEM C WITH NOT KNOWING THE QUEUE

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

Can Someone Please Point Out Why My Code Fails For F?

195704952

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

My casework solution for E1 lol, it actually helped me realize the general solution for E2 and only needed a few tweaks.

void solve(){
    int n, k;
    cin >> n >> k;
    string a, b;
    cin >> a >> b;
    string x = a, y = b;
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    if(x != y){
        cout << "NO" << endl;
        return;
    }
    if(a == b){
        cout << "YES" << endl;
        return;
    }
    if(a.length() >= 6){
        cout << "YES" << endl;
        return;
    }
    if(a.length() <= 3){
        cout << "NO" << endl;
        return;
    }
    if(a.length() == 4){
        swap(a[0], a[3]);
        if(a == b) cout << "YES" << endl;
        else cout << "NO" << endl;
        return;
    }
    if(a.length() == 5){
        if(a[2] == b[2]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}
»
4 года назад, скрыть # |
 
Проголосовать: нравится +47 Проголосовать: не нравится

As a tester, I was late xD

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

A: Implementaion.

B: For each pair of lowercase and uppercase we count their occurence, let they be cnt1 and cnt2, then it contribute min(cnt1, cnt2) to the answer we can get initially, and abs(cnt1-cnt2)/2 to the answer we can get by operation, so the answer is sum(min(cnt1, cnt2)) + min(k, sum(abs(cnt1-cnt2)/2)).

C: We can maintain a priority queue. We scan the array from left to right, when s[i]>0 we push it into the priority queue, and pop an element and add it to the answer when some s[i]=0.

D: Let f(i) be the string after removing s[i] and s[i+1], then f(i)==f(j) (i<j) is equivalent to s[t]==s[t+2] for all t in range [i, j-1]. Therefore, let the initial answer be n-1, and each t that s[t]==s[t+2] will contribute -1 to the answer.

E: First check the trivial case when s and t are different after sorted. For a pair of (s[i], s[i+1]), if i>=k, we can swap them by:

(s[0], ..., s[i-k], ..., s[i], s[i+1], ..., s[n-1]) --> swap (i-k, i) -->

(s[0], ..., s[i], ..., s[i-k], s[i+1], ..., s[n-1]) --> swap(i-k, i+1) -->

(s[0], ..., s[i+1], ..., s[i-k], s[i], ..., s[n-1]) --> swap(i-k, i) -->

(s[0], ..., s[i-k], ..., s[i+1], s[i], ..., s[n-1])

Similar for i+1+k<n. So if every pair of chars can be swaped like this, which means n>=2*k+1, we can re-arrange the string arbitrarily. If n=2*k, we can swap (s[k-1], s[k]) like this:

(s[0], ..., s[k-1], s[k], ..., s[2*k-1]) --> swap(0, k) -->

(s[k], ..., s[k-1], s[0], ..., s[2*k-1]) --> swap(0, k-1) (we can re-arrange [0, k-1] arbitrarily since we can swap every pair in this range) -->

(s[k-1], ..., s[k], s[0], ..., s[2*k-1]) --> swap(0, k) -->

(s[0], ..., s[k], s[k-1], ..., s[2*k-1])

Finally, if n<2*k, there are some chars in the middle can't be moved, but we can re-arrange every movable chars like steps above. So we need to check every unmovable positions of s and t.

F: Bitmask. Let mask1(s)= the letters occurs odd times in s, mask2(s)= the letters occurs any times in s. Then (s, t) is a good pair is equvalent to popcount(mask)==25 && mask&mask2(s)==mask2(s) && mask&mask2(t)==mask2(t), where mask=mask1(s)^mask1(t). Therefore we can calculate the contribution of every mask[i]=(1<<26)-1-(1<<i) for i in range [0, 25] using a map.

G: Tree hashing. If the root has even number of childs, the hashcode of subtrees of these child must appear in pairs, and if the root has odd number of childs, there must exist a child with symmetric subtree, and the hashcode of other subtrees appear in pairs.

Some explanation about tree hashing
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

First time to solve all the problems in Div.3 ^_^

(But without coding)

Talk is cheap.jpg

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

Finally solve till E2 :) .... Dream comes true lmao

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

I think this round's problems where a little too easy for div 3 lol, but I love it. I think I'm hitting Specialist for the first time after this round too, so that's great

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

    Bro can you plz explain briefly the idea behind your graph implementation for E1?

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

      I think it's straightforward. Since you can swap any two characters as long as their indices have a difference of k or k+1, that means that a character can make its way to any spot that's "connected" to its current spot via the k and k+1 index difference. So you can create an adjacency list for every index (which contains at most 4 other indices by the way, meaning that you can even get rid of the adjacency list if you feel like it's unnecessary) and use it to find all the "connected components" where a character can possibly go with depth-first search (dfs). Then all you have to do is iterate over each character of the target string and check if there's at least one available character in the first string which can reach this specific spot via a connected component. Also I know this solution is a little overkill for this problem, but it's the first thing I thought of and I didn't want to waste too much time thinking about another one during the contest. I hope I explained it well

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

Really nice contest! Good job :D

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

Thanks for strong E2 pretests! WA on test 20 was really helpful

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

D is very cute!
G: About rooted tree hashing

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

    You don't need hashing, there is deterministic and simplier solution: for each vertex let's calculate the number, which represents equivalence class by isomorphic relation. To do so, we calculate these numbers for all childs, put them into a vector, sort it, then using smth like std::map<vector, int> we can determine the equivalency class for current vertex.

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

This contest was easy.

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

Solution to E without any implementations

  1. We have to make $$$s$$$ equal to $$$t$$$. Let's use Meet-in-the-middle
  2. Let's make $$$s$$$ and $$$t$$$ minimum lexicographical as possible. If after that $$$s=t$$$ answer is YES and NO otherwise.

[solution]

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

I solved C1 with DP and I couldn't convince myself how PQ works on this problem. Take the case:

5

5 4 2 0 0

I see why it works now because we only have to return count but technically what happens if you simulated is that the first hero picks card 0 and the last two cards are discarded. I think if you had to return the cards that each hero picked in the answer, PQ wouldn't work right?

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

    Yes, that was my concern too. But since we don't have to return the order of the picks, then we just need to prove that some optimal picking order exists such that you can use all of the max values before the 0s. I didn't prove it, but I didn't see why some optimal picking order shouldn't exist which implies the priority queue sum is optimal.

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

    I think we could store pairs <value, card order no> in priority queue. PQ solution will then tell us which cards should be used. After that filtering, our task becomes trivial as we know exactly which cards will be used. We can recreate each hero pick on the second run with selecting only those filtered bonus cards (by using stack)

    It is what I came up with, it might be possible of doing it in a single run through cards

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

E can also be solved with DSU. It can be done by merging all positions with distances k and k + 1 between them and checking for each connectivity component if set of letters on corresponding positions in s and t are the same: 195646722

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

Good contest! A-F were smooth :)

Although I was able to solve A-F however I'm still trying to wrap around the fact that why would initialising the unordered_map elements make a difference.

This works -https://codeforces.me/contest/1800/submission/195719096

This fails — https://codeforces.me/contest/1800/submission/195719053

The only difference b/w the 2 being that in the working code I have initialised all characters to 0. Aren't unordered_map elements given a default value 0 when not present? I also tried explicitly checking for the members but no luck!

I would be grateful and really appreciate if someone could help me with this.

Thanks in advance :)

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

What's the proof of C?

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

Can anyone explain why this approach works for D? I did testing on random strings in compare with brute force solution and could not find test that would break the solution.

int ans = 0;
pair<char, char> last;
for (int i = 0; i < s.size() - 1; ++i) {
    pair<char, char> cur = { s[i], s[i + 1] };
    if (cur.first > cur.second)
        swap(cur.first, cur.second);
    if (cur != last)
        ++ans;
    last = cur;
}
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

1592B - Хемосе в магазинах Similar to E1 and E2 But I did not solve them, although I solved this problem more than a year ago

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

Isn't G a little bit easy for its position?

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

    Depends on the person I would say. Idea definitely wasn't hard to find but implementation and execution might be hard if you're new to the concept. In my case I found the idea when there were 20 minutes left but had no idea how to correctly implement it.

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

1592B - Hemose Shopping

Similar to E1 and E2 But I did not solve them, although I solved this problem more than a year ago

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

Antihash tests? My solutions with unordered_map/cc_hash_table passed (task G), but gp_hash_table got TL on testcase3. And after making my own hash all is OK. UPD after systests. cc_hash_table gave TL. But unordered_map is fine

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

SO HAPPY !! Got a sub 1k rank for the first time ! Loved the questions

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

This is my second codeforces contest!

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

flunked very hard on E1 and E2, stuck for over 1.5 hours and could not solve them..

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

Forgot to use long long for answer in C1 and C2, and I kept thinking I was using the wrong approach, so I couldn't solve either of them. Gonna fall to newbie now :(

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

Regarding problem F, the time constraint for this problem is pretty tight,and the judge's behaviour is hence arbitrary. Check these submissions,195747465 and 195747315. I have submitted the exact same code twice, getting accepted verdict in one submission. Could someone suggest a faster algo, and hack this solution if this is'nt the intended one.

UPD: made it faster using hashing, fits well into the time limit now.

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

So interesting the problems are in this contest,I love this contest!but I think pretest in A maybe weak.

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

why my solution for problem A got hacked? qwq

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

For F task I got AC in java but getting wrong answer when i convert in to C++. Please help, i am new to C++

AC 195755004

WA 195754099

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

in problem A , bad tests -_-

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

Has the system test finished? When will the rating update?

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

Why was that div3 round unrated for me? I'm under 1600...

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

hope this will make me expert

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

When will the editorial be out?

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

late editorial :sadge:

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

How to prove the greedy solution of problem C?

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

    Let's start with simplifying the problem. For each hero card we want to pick one booster card that appears before it. We may not use the same card twice. Heroes are interchangable because in the end it doesn't really matter which one gets which card. So, we traverse through the deck from top to bottom. Everytime we find a booster card we put it in a priority queue which shows the current best booster we can give to a hero. When we encounter a hero, we give them the top booster from the priority queue. We can do that because, at the end, we will have used a booster card at most H times where H is the amount of the heroes in the deck. Each of the cards is used in a legal manner (as when we consider a hero our priority queue only contains the cards that appeared prior to it). That means that if we choose the take operation for each of the cards we used in our final solution and the discard operation for everything else, we don't have to worry about the fact that you put the cards on top of the bonus deck beacuse we will have at most H cards and each hero will get one of them (Basically, we don't get any "garbage cards" that we don't want to use in the bonus deck. That means that the order in the bonus deck doesn't matter as we don't really care which hero gets which card as long as it's legal)

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

Why has this contest been removed from rating upgrades?