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

Автор 74TrAkToR, история, 19 месяцев назад, По-русски

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

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

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

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

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

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

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

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацией моей работы, pashka за помощь с идеями для задач и координацией моей работы. Задачи были придуманы и написаны MikeMirzayanov, 74TrAkToR и pashka. Также стоит отметить, что в этот же день будет проходить командная олимпиада ЮМШ, где будет большая часть задач раунда.

Также большое спасибо: Gornak40, meowcneil, Vladosiya, senjougaharin, efimovpaul, powergee101, tanus_era за тестирование раунда и весьма полезные замечания. Список тестеров будет пополняться.

Всем удачи!

UPD: Разбор

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

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

As an enthusiastic coder, I will comment first :)

»
19 месяцев назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Finally, my first Unrated Div.3!!

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

Classical + Mathematics

»
19 месяцев назад, # |
  Проголосовать: нравится -27 Проголосовать: не нравится

Can anyone tell me why I am getting TLE on this submission? https://codeforces.com/contest/1665/submission/176381750

»
19 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Fell down below 1600 due to FST. Getting a chance to rise, the very next day! Thanks!

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +106 Проголосовать: не нравится
»
19 месяцев назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

Wow, I thought to give Div3 Tommorow but became an Expert today :)

Spoiler
»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The current number of upvotes is 74, and the announcement was sent by 74traktor. Leave a message to commemorate it.

»
19 месяцев назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

The current number of upvotes is 74, and the announcement was sent by 74traktor. Leave a message to commemorate it.

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

    Quick, upvote this comment so when it has +66, we can commemorate it as well!

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

      I don't really care about that, but 74traktor is a very high level coordinator, and we're working with him, and I think the problems he set must be great.

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится
Spoiler
»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

It is so good that contest are hold often :)

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

О, Женя, раунд от тебя и Паши Маврина! Имба!

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wishing everyone positive delta, although that is technically impossible.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I think the number of participants will be less than the average due to EL CLASSICO time which is the same as the round

Spoiler

GL everyone !

»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Custom Invocation is broken, runs forever.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Did 6/7, but the overall user experience is rather poor compared to Leetcode. Custom invocation was crushing for the first hour, making it impossible for me to test my solutions. Sure I can get an external interpreter which I guess I will have to do next, meh. Adding a dedicated problem discussion would be really nice, to compare ideas and solutions.

»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

These math rounds always make me revisit my high school math. Nice questions though

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hint for E1 Please

  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
    Hint
  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    check for all possible x(or y).

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

    I used sieve. You can also think of solving it with sieve

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve problem E2?

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

how to solve problem d??

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

    Some number $$$m$$$ is divisible my $$$2^n$$$ if it has $$$n$$$ twos when you break it down into prime factors.

    Firstly you need to count the number of twos in product of all numbers in $$$a$$$. If there is less then $$$n$$$ twos, you will need to multiply some numbers by $$$i$$$. It is best to multiply with $$$i$$$ s with most twos when you break it down into prime factors first. When you have number of twos greater than or equal to $$$n$$$ you are done. You just need to output have many times you multiplied with $$$i$$$.

    My submission: 176530693.

    • »
      »
      »
      19 месяцев назад, # ^ |
      Rev. 2   Проголосовать: нравится +2 Проголосовать: не нравится

      As an alternative way (simpler implementation), you can generate an array of all numbers in $$$[1,n]$$$, sort them in decreasing order by the number of trailing zeroes they have in their binary representation (this is essentially the same with the number of $$$2$$$ in its prime factorization), and do a simple iteration on it. My submission is 176524669.

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

        Please help me with this solution. I pretty much did something similar but it got hacked 176544364

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

          You are iterating over an array of size $$$2\times 10^5$$$ on every test case. This is $$$O(NQ)$$$ (given $$$N=2\times 10^5$$$). You need to reduce this number of iterations to $$$n$$$ on each testcase, to use the fact that the sum of $$$n$$$ in all test cases is not bigger than the maximum value possible.

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

        178050351 chromate00 please help me to see why my submission is wrong, I can not understand, thank you very much

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

          It's hard to exactly point out the issue on this solution, but I think it should be an overflow issue. (You could use addition instead of multiplication in this problem.)

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thank you for having wonderful Div 3 Test. Thanks to all concerned who organized the test.

It is to inform that in Question "E1 Divisible Numbers (easy version)" I have submitted my code in python.

In third test, there is a possible answer 9 16. But autorun rejected my code on test 3. It is informed that it is valid answer as per your conditions. Kindly check and please accept my code. You can restrict the answer if there are multiple answers.

Thank you.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

how to solve E2 ?

  • »
    »
    19 месяцев назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    it's not hard you need the a*b divisors but since it's too large you could get the divisors of a and b and then multiply each two elements of both numbers divisors and put it in the array of a*b divisors and the rest is the same

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

can anyone please tell me why in question D in this case 4 13 17 1 1 the answer is -1 after (13⋅1)⋅(17⋅2)⋅(1⋅3)⋅(1⋅4) this operation for 1 time if i choose i=2 and do (17,2) again then what will be the total number of factor in the multiplication there will be 4 factor of 2 and the multiplication is divided by 2^n as n=4 here so why the answer is -1 here as here it is said i can do the operation as many times but in each operation the chosen index should be different?

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

    You cannot apply the operation repeatedly to a single index. In other words, all selected values of i must be different. I guess, you didn't pay attention to this sentence.

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

    The statement stated that you can apply the operation on each index only once.

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

    You can do at most $$$n$$$ operations. You can't choose any $$$i$$$ more than once.

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

I think my solution for E1 is hackable, can anyone try to hack it?

https://codeforces.com/contest/1744/submission/176559805

»
19 месяцев назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Anyone here who knows Java and has solved Traffic light problem?

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hello guys. I want to cry. LOOK AT THIS PLEASE. I just send this code in the round and it got TL (problem D).

for (int i = 0; i < n; i++) {
    cin >> a[i];
    pr *= a[i];
}
while (!(pr & 1)) {
    k++;
    pr >>= 1;
}

But now, I send this, and it got "OK". Can someone answer me — "WHY?":

for (int i = 0; i < n; i++) {
    cin >> a[i];
    while (!(a[i] & 1)) {
        k++;
        a[i] >>= 1;
    }
}
»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Such a unlucky contest for me. Spent more then 90 minutes combined on $$$A$$$ and $$$C$$$ trying to figure out why I am getting WA, reimplemented both problems in a little different way and got AC...

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

I Wanna shoot my HEAD .. I spent half an hour trying to understand wtf is wrong with my E2 Solution and in the end I realized i wrote in the for loop divo2.size() instead of j<divo2.size() .. I wanna **** my stupid code .

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

https://codeforces.com/contest/1744/submission/176594390

can anyone show me a testcse where my solution not fits?(problem c)

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

I liked B, especially D.

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

Solved the last task of the round for the first time!!!!!! Indeed its a new exciting day!

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

    What is your approach for problem F?

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

      Well,

      1. First realize that for MEX > MED, the first t elements should be 0 1 2 ... t-1

      2. Now, save the tighest bounds for {0} ,{0 1}, {0 1 2}, ... using two arrays, to be used on demand

      3. Iterate on t [from 1 to (n+1)/2 ]

      4. The sub array size could be 2t or 2t-1 and so, calculate the left and right slacks, you can get the possible number of subarrays for this t.

      I felt the base testcase which they gave was veryy good, I corrected 4~5 bugs using it.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How did this solution get hacked? 176544364 I'm certain my solution was correct. For every power of 2 I will take the largest 2^i which costs me 1 unit and gives me a lot of 2's. Even positions will also give me 1 unit of cost for a single 2. I combined both and sorted based on largest 2 giver. Then took prefix count.

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

    When the condition twos >= n is fulfilled, you always iterate over all two array: for (auto [i, j] : two). So complexity of your solution is $$$O(t M)$$$, where $$$M = 200000$$$. So, it is obvious that this solution will most likely get TL.

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

One of the hacks that works for E1: 10 1 1 100000 100000 1 1 100000 100000 1 1 100000 100000 1 1 100000 100000 1 99999 100000 100000 1 99999 100000 100000 1 99999 100000 100000 99999 99999 100000 100000 99999 99999 100000 100000 99999 99999 100000 100000

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

176594240 It says that my answer is wrong in 17th test case but when I am running on my compiler and other online compiler I am getting correct answer. Someone please help my solution was correct still I had to stuck in this question because of this error. Thank you in advance!

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

    Don't use floating point operations unless you have a concrete proof that the result will be exact.

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

    At least, your rounding (long long int)log(...)/log(2) doesn't always work...

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why isn't there score distribution in Div.3 and Div.4 rounds like in Div.2 and Div.1 rounds?

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

    Because Div. 3, Div. 4 and Edu rounds follow ICPC rules

  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

    It follows the format of Extended ICPC, meaning that rank is first determined by solve count, and then by penalty. Still, there is a reason why solving (subjectively) easier problems first is more beneficial. We need to understand that the penalty is the sum of the penalties on each problem. Now to simplify things, lets assume you can solve A in $$$5$$$ minutes and B in $$$10$$$ minutes, and there are no more problems than these two. If you solve A first, the penalty will be $$$5+(5+10)=20$$$ minutes. However if you solve B first, the penalty will be $$$10+(10+5)=25$$$ minutes. Therefore in this simplified model, solving the easier one first is ideal. We can generalize this to more than 2 problems, and understand that it is ideal to solve problems in increasing order of difficulty.

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

      I know what format of Extended ICPC means, but why format of Div.2 rounds isn't used?

      • »
        »
        »
        »
        19 месяцев назад, # ^ |
          Проголосовать: нравится -11 Проголосовать: не нравится

        I wish I knew. IIRC Div.3 was planned to be Ex-ICPC format from its first round and on, but I don't exactly know why they decided it that way.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Solution for F:

Enumeration $$$i$$$ from $$$1$$$ to $$$n$$$,consider subarray $$$Sub$$$ which's median is $$$a[i]$$$.

To make $$$MEX(Sub)>MED(Sub)$$$,$$$1,2,...,a[i]∈Sub$$$ must be hold.

Use binary search to find the min subarray $$$Sub_{min}$$$,which contains $$$1,2,...,a[i]$$$.

Next,we have to make sure that $$$a[i]$$$ is the median.We can add some numbers on the left and right sides of $$$Sub_{min}$$$ to achieve it.Then we can easily count it.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

nice problems

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can you rise TL on E? So many hacks by TL, that should not happened

»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

How to solve E2? Can someone explain in a easy way?

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

    You can get the prime factors of a, and b. Then create every possible pair of numbers with those factors.

    For example, if a = 2^2 * 3, b = 2^3 * 5, then a*b = 2^5 * 3 * 5. all possible pairs are

    1 480

    2 240

    ...

    In the end, check if the pair has the constraints. (if x <= a, then make x to (a/x + 1)*x).

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

    Prerequisite: Maximum number of divisors of n if $$$ n \leq 10^9 $$$ is 1344, you can refer oeis and this comment.

    So first calculate all divisors of a and b. And iterate over all possible pairs of divisors of a and b, be l and m. Try to set x as multiple of l*m and y as a multiple of $$$ \frac{a*b}{l*m} $$$

    Overall complexity would be : $$$ O(\sqrt{A}+\sqrt{B}+A^\frac{1}{3}*B^\frac{1}{3}) $$$

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

Epic tests for problem E1, thank you!

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

10 1 1 100000 100000 1 1 100000 100000 1 1 100000 100000 1 1 100000 100000 1 99999 100000 100000 1 99999 100000 100000 1 99999 100000 100000 99999 99999 100000 100000 99999 99999 100000 100000 99999 99999 100000 100000

I hacked 31 Solutions of E1 problem using this testcase.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Unfortunately.your solution on E1 has been hacked:(

»
19 месяцев назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

rainboy Can you please explain your solution for Question 1744F - MEX vs MED ?

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I could have been an expert, but my E1 got hacked...TAT

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

A job is free for you, 15$ per hour during contests so you remind me to use long long for all variables.

The second contest this week I get WA because one of the variables is int

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Why do you set first to true when i==n?

    What about rgr?

    View your code on a mobile phone without custom test. Forgive me if I were wrong.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Editorial?

»
19 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

isn't it a rated contest? When it will changes our rating?

  • »
    »
    19 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    I guess, tomorrow at the latest (2 div3 contest ago they took 1 day to update rating, as cheaters were being eliminated)

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

Why is this code only gives YES as output?

include <bits/stdc++.h>

using namespace std; int main() { int t; cin>>t; while(t--){ int n,k=0; string s; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } cin>>s; map<int,char>m; for(int i=0;i<n;i++){ auto it = m.find(a[i]); if(it==m.end()||s[i]==(*it).second){ m.insert(pair<int,char>({a[i],s[i]})); } else{ k++; } } if(k==0){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } return 0; }

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve F ?

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

    Assume a segment s of size k. To have mex(s) > med(s), s must atleast have the elements 0, 1, 2, ..., k/2. With this knowledge, we can now keep track of the index at which each p_i occurs, Now we iterate k from 1 to n, and maintain two variable l and r to keep track of the leftmost and rightmost index between which 0..k/2 are located. If r-l+1 > k, then we have no good segments of size k. Else the number of good segments would be given by min(l, n-k) — max(0, r-k+1) + 1. The expression above is simply the number of segments of length k that contain the range l..r

    You can see my submission here: https://codeforces.com/contest/1744/submission/176616730

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why is this code giving tle? it was working fine in the local editor code-my submission

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

E2 passed , E1 failed :(

»
19 месяцев назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

I'm talking about the coincidence with the decisions of other participants. This is not fair, I wrote the code completely by myself, it took more than an hour. You can see the evolution of my code and attempts. I do not understand at all how someone could copy my code, please do not ignore my attempts, since this is only my second contest in the rating. I have not logged into my account for a long time, I will try to change the password. Please at least update my rating, i been waiting all day for this and at the end of this. Next time I'll be more careful with my account. https://codeforces.com/contest/1744/submission/176557816 https://codeforces.com/contest/1744/submission/176570918 https://codeforces.com/contest/1744/submission/176579287 https://codeforces.com/contest/1744/submission/176580294

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve the problem of E1????

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

    My naive solution was , iterate on x from a+1 to c and try to calculate y by taking x.y = a.b.1 or a.b.2 or .....

    This passed the system tests at first, but got hacked later on

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

too ez! try harder next time.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve problem B? I get TLE on test 5

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

    Just have one variable for the sum of whole array. You also need to keep track of number of odd elements and number of even elements. If you iterate over the array every query that will be $$$O(nq)$$$ which is too slow.

    At the beginning you need to count the number of odd and even numbers in an array and calculate the sum. In every query will add $$$x$$$ multiplied by number of odd/even numbers to the sum. Note that number of even and odd numbers changes so try to update those numbers without iterating over the whole array. Try to think about the parity of

    $$$2k+2k$$$,

    $$$2k+(2k+1)$$$,

    $$$(2k+1)+(2k+1)$$$

    to calculate new number of even and odd numbers after each query.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How hacking benefit you in educational rounds by point Like in general div2 round it will increases your points.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How hacking will increases your points in div 3 or educational round Like in general div 2 round it will increases your point by 50.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Getting hacked sucks! I fell from rank 200 to 1000... Regardless...the round was GG

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can someone explain the E2 for me,I got no idea on this problem,thx!

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

    E2 is quite simple. You first use Sieve to find all the primes in the range 1 to max(sqrt(a)+1,sqrt(b)+1). Then, you do prime factorization on both a and b and push back all of them into a vector. After that just use somewhat like a knapsack dp to find all the factors of a*b. Try if the pair of factors can fit into a<x<=c and b<y<=d by multiplying a constant k. If it is possible output the answer, else output -1 -1.

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

      I think I applied your idea just by a different way.

      I pushed all the prime factors of a*b in a vector and generated different combinations so that the factors can be distributed into 2 sets for x and y, but would not it cost us (2^size). In problem E1, size can go upto 32 at max, so still it gave me TLE.

      I think I am missing something.

»
19 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

finally Expert!!!

»
18 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi, can anyone please help me with my solution to D solution. I've been debugging it for some time, but idk whether it is the way I found largest power of 2 below n gives the wrong answer. Thanks a lot in advance!

»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

nice round