Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Автор MikeMirzayanov, 7 лет назад, перевод, По-русски

Обратите внимание, что мы напряглись и подготовили дополнительные задачи для Div 1. Таким образом, параллельно с отборочным раундом будут проведены Codeforces Round 440 Div.1 и Div.2 (рейтинговые раунды для обоих дивизионов — всё как вы любите). Участвуют все!

Добрый день.

15-го октября в 11:05 (московское время) стартует Отборочный Раунд 2 (и открытые раунды для обоих дивизионов по его мотивам) олимпиады для школьников Технокубок 2018. Раунд будет длиться два часа, участникам будут предложены 6 задач. По его результатам лучшие участники (но не более 45% от общего числа участников раунда) будут приглашены на финальный этап в Москву. Для регистрации на раунды и участия перейдите по ссылке. Не забудьте заранее зарегистрироваться на раунд. Впрочем, если забудете — не беда. Через 10 минут после старта будет открыта дополнительная регистрация для опоздавших (ее длительность — 20 минут).

Зарегистрироваться на Отборочный Раунд 2 →
Соревнование открыто для всех в виде отдельных раундов для первого и второго дивизионов.
Для всех участников всех трех редакций этого соревнования будет пересчитан рейтинг.

Напомним, что согласно правилам раундов Codeforces во время соревнования ваши решения будут тестироваться только на претестах (предварительном и неполном наборе тестов), а системное тестирование состоится после окончания раунда. Обратите внимание, что претесты не покрывают все возможные случаи входных данных, поэтому тщательно тестируйте свои программы! После прохождения претестов у вас будет возможность заблокировать решение, тем самым получив привилегию искать ошибки и взламывать чужие решения, но отказавшись от возможности перепослать ваше решение при каких-либо обстоятельствах (например, даже если вы найдете ошибку или вас взломают). Со временем задачи падают в стоимости. После системного тестирования учитываются только полные решения. Подробнее про правила соревнований можно прочитать по ссылкам:

Регистрация на олимпиаду Технокубок еще открыта. На кону — значительные квоты при поступлении в престижные технические вузы России и ценные призы. Если вы — школьник 8-11 классов и пока не зарегистрировались на Технокубок, то самое время сделать это:

Зарегистрироваться на олимпиаду →

В финал соревнования будут приглашены лучшие участники каждого из отборочных раундов (но не более 45% от общего числа участников раунда).

Желаем удачи на олимпиаде,
MikeMirzayanov и команда Технокубка

Опубликован разбор.

Поздравляем победителей!

Отборочный раунд Технокубка:

  1. Mikhniuk
  2. scanhex
  3. Krisha
  4. lis
  5. FalseMirror

Div. 1:

  1. khadaev
  2. Errichto
  3. eddy1021
  4. FizzyDavid
  5. fateice

Div. 2:

  1. wdmmsyf
  2. Legilimens2023
  3. destinydrifter
  4. oscar114514
  5. OMS
  • Проголосовать: нравится
  • +188
  • Проголосовать: не нравится

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

Пересекается с GP of SPb :(

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

Mandatory comment- "Hope the problem statements are as short as this blog".

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

Clash with OpenCup. ;(

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

Is it me or is the contest title is longer than the announcement :3

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

I guess it's the first time that we don't see any "thanks" or even any username in an announcement :D

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

This is like the shortest announcement ever of all time.

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

A good time for Chinese students!

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

I have an onsite contest after 15mins for 5 hours, and then I can take part in this cf round. A good time for me.

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

I have doubt.

When I opened 'contests' page, it showed me two separate contests(div1 and div2), but in the announcement it is given (Div1 + Div2). Which one it is going to be ? MikeMirzayanov

UPD : when I posted this comment, there were only 2 contests. (contests 440Div1 , 440Div2).

That's why I got confused. Right now contests page is fully updated. NH_Apu

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

I Wish everyone positive rating!

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

why do timing varies a lot recently ??

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

I hope I won't get a WA on problem A, the way it happened in the previous contest :(

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

It will be at 3 AM here in Colombia. Guess is a good way to start a Sunday ¯_(ツ)_/¯ .

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

2 PM in Bangladesh..Surely the best time except for missing lunch

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

The Terms of agreement when registering is in Russian "Вы подтверждаете, что будете работать самостоятельно во всех этапах Технокубка и не будете нарушать какие-либо другие правила." So I'm wondering whether an English version of problem statements will be given during the real contest. Can anyone explain about this a little bit? Thanks a lot.

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

gl hf

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

Надеюсь в этот раз MikeMirzayanov не промахнётся по скриптам.

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

number of problems and the difficulty is about the 1st round ? because that round was easier than ususal

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

What's the "Practice Round 2"?

EDIT: never mind, seems to be for Technocup official participants only

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

Hope there will be no geometry problems

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

May be it's a silly question.

but what does "00:04" like things below every submission means??

is it time of submission or what

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

    You mean the time that is shown below the submission during the contest.

    Its the time when you've submitted the solution after the start of the contest. '00:04' Would mean that you've submitted the solution after 4 minutes

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

How long will the contest last?

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

have no time to receive it :D

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

Why can I register for both Codeforces Round 440 (Div 1) and Technocup 2018 round 2?

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

How many problems?

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

YouHaveShort Blog.

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

Registration button didn't work for me...

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

Mandatory comment- "Thankyou for the short problem statements".

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

Disclaimer: My argument may be wrong, and if it is, I don't mean to offend anyone, so apologies in advance.
The contestant who is currently second (at the time of commenting) in the leaderboard looks mighty suspicious. He has solves solves for 3 different problems in the space of 6 minutes, including solving D in 2 minutes. Check out his submissions.

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

In Div-1 B, just ask n queries of the form (i, 0) and n queries of the form (0, i).
Now, if you know p[i], you can get p[j] using p[i] ^ query(i, 0) ^ query(j, 0).
And if you know b[i], you can get b[j] using b[i] ^ query(0, i) ^ query(0, j).

Now, one by one, fix the the value of p[0] from 0 to n-1. Then you can recover the whole permutation p[].
You know that b[p[0]] = 0, so you can recover the whole inverse permutation b[] as well.

Check if both are valid. All elements of p[] are distinct and 0 <= p[i] < n && b[p[i]] = i.
It this is true, this is a valid answer. Simply count the total and print any one of these.

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

    I only stuck for checking is it valid permutation. Simply I do not see why it means that all n2 pairs will produce correct answer as valid permutation.

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

      If you do these 2n queries all other queries are redundant.
      Q(i, j) = Q(i, 0) ^ Q(0, 0) ^ Q(0, j)

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

    Yeah so querying these is enough.

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

    I did not check that p[] are distinct, but I don't think that there could be 2 the same elements.

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

    All elements of p are always distinct in all potential permutations.

    Say pi = pj. But then xor(pi, pj) = 0. Hence pi = pj in all potential permutations and there is no answer.

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

    Besides, you need to apply this procedure only for even n. For odd n, p0 is uniquely determined, hence only one possible permutation.

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

    My solution:

    I first find the value of a[0]^b[i] for all 0<=i<n (by query(0,i)) let v[i]=a[0]^b[i] for all 0<=i<n Next, I fix the value a[0]=j, 0<=j<n Now, its not hard to produce b and the corresponding a array using the above definitions. Then, just check the validity of this solution.(All this is being done for a fixed value of j) What's wrong with this approach? I am getting WA at test 7

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

Ok, so what are the hacks on B? Thanks for short statements, by the way.

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

literally 1 sec from submitting D and the contest ends :/ .

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

How to solve Div-1 C?

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

    Let's say that two points are connected if they lie on the same horizontal or vertical line. Find connected components. For each of them, let L denote the number of possible different lines you can draw, and let P denote the number of points.

    For example, for a single point L = 2 and P = 1. For two points with the same y-coordinate it would be L = 3 and P = 2. For the sample test with four points it would be L = 4 and P = 4.

    It turns out that you can draw a subset of L possible lines if and only if its size doesn't exceed P. So the answer for this connected component is .

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

    Make a bipartite graph like this :

    In one of the parts put a node for every x. And in the other part put a node for every y. Now a point in the problem at coordinate (xi, yi) is an edge in the graph that is between node xi in th first part and the node yi in the other part .

    Now consider a connected component , consider that it has k nodes.

    If this component has a cycle , then you can make all 2k states for horizontal or vertical lines in this component .

    Otherwise when the component is a tree you can make all of the states minus the state that all the nodes (vertical and horizontal lines) appeared , so it has 2k - 1 states!

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

    I see Div1 C smth likes ARC83 F: https://atcoder.jp/img/arc083/editorial.pdf.

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

Hints for Div2 E?

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

how to do C?? i submitted in last 3 min..

if(x&1 || x<4) ans=-1;

if(x%4) ans=x/4

else ans=[(x-6)/4]+1

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

wait whoops i forgot to flush output for final answer for B and i still passed pretests even though the problem warns against this, i hope i pass systest...

EDIT @below: Nope, I used '\n' to end my line, I really hope I'm okay...

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

пипец чет сложна

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

Hacks for C?

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

Fun solution for Div.1 D:

The main observation is that the distance for every pair is either 0, 1, 2 or 3.

You can easily find the number of pairs with distance 1 (they have gcd ≠ 1 and this is a well known problem).

For the number of pairs with distance 2 the following condition should be true:

lp(X) * lp(Y) <  = n, where {X, Y} is the pair (lp(x) here is the least prime divisor of x).

That's true, because we can have a path like X -> (lp[x] * lp(y)) -> Y.

And now we are left with pairs with length 3. The following conditions should be true:

lp(X) * lp(Y) > n and max(lp(X), lp(Y)) * 2 <  = n, where {X, Y} is the pair.

That's true, because we can have a path like X -> (2 * lp[x]) -> (2 * lp(y)) -> Y.

Well if we have found the number of pairs of distance 2 and we count the number of pairs for which max(lp(X), lp(Y)) * 2 <  = n is true and then remove the number of pairs with distance 2 we will get the number of pairs with distance 3.

Well now the only part is how to count the number of pairs with the given two conditions. We can do a fenwick tree on the values. Here is the code.

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

    Why is distance being further than 3 impossible?

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

      Because for every pair {X, Y} if there is a path, then we can go like X -> (2 * lp[x]) -> (2 * lp(y)) -> Y.

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

    Could you explain how you count these pairs with a fenwick tree a little more? Maybe it's less complex than I'm making it out to be, but I got the conditions in-contest but couldn't figure out how to count them easily.

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

      First we do n - 1 point updates of form add 1 to lp(i).

      Now we start iterating all numbers from 2 to n. Let our current position/number be i.

      • We remove 1 from the fenwick tree at position lp(i). Now the number of pairs with lp equal to X is the value at position X in the fenwick tree.

      • To count the number of positions lp(X) * lp(Y) <  = n we can simply query the range [2;n / lp(i)].

      • For the second condition (lp(X) * lp(Y) > n and max(lp(X), lp(Y)) * 2 <  = n) we will have query in range [2;n / 2] — query in range [2;n / lp(i)].

      • And we only add the second part to the answer (the pairs with distance 3) if 2 * lp(i) <  = n.

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

        What does cnt[i] calculate in your code?

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

          Initially the number of numbers divisible by i. Then the number of pairs of numbers with gcd equal to i.

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

            Ok I finally got the key part I've been missing , namely the fact that if x and y are distinct, not coprime and at most n then the product of the smallest prime factor of both numbers must be at most n.

            Proof : Let g be the gcd, then if g does not exceed sqrt(n) we're done. Otherwise, let x = ga, y = gb, and wlog b > 1. Then, the product of smallest prime divisors is at most gb which is at most n.

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

    I don't think we need BIT here.

    To find the number of pairs for which lp(i) * lp(j) <= n, just store the prefix frequencies of the lp array. Then for every i, add pref[n / lp[i]]. Remove the number of i, such that lp(i) * lp(i) <= n, and divide by 2.

    Link

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

    Thank you for this solution. I would like to add that it can be adapted to O(n) by using two pointers instead of Fenwick trees. Code : 31374591

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

Does any one solved problem div2 C using DFS / BFS or Recursion or dp ?

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

    I used greedy: keep subtracting 4 from the number.
    If n % 4 == 1: Use 9 as your composite number.
    If n % 4 == 2: Use 6 as your composite number.
    If n % 4 == 3: Use 15 as your composite number.
    This is the rough idea behind the problem.

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

May be rename to Mathforces?

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

For some reason, for Div 2 C I thought that the queries themselves had to be prime to be valid, and I would need to print out -1 if the queried number wasn't prime.

I wrote up the entire code of getting all the primes less than sqrt(1 billion) by checking for primality with a sieve. Then I checked for each query number if it was not prime by seeing if it could be divided by any of these prime numbers < sqrt(1 billion) I found through the seive, and then I realized I had interpreted the problem wrong and had added more requirements than necessary!

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

    Anyway, how did you check primality of numbers up to 1e9 using sieve, not miller-rabin?

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

      I found all the prime numbers less than sqrt(1e9) using a sieve. There were about 5,000 or so I think.

      I stored all these primes in a vector.

      And to check whether each queried number N was prime, I just iterated through the primes and checked if any of them could divide N.

      This would come out to about 5 * 1e8 time.

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

waiting for system test.

»
7 лет назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

When will the system test start?

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

Come on, khadaev. We agreed to submit on 1:30 -_-

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

How to solve div.2 D? It's it about circles of permutation?

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

    It's about n^2 brute-force. You can query (0..n-1, 0) and (0,0..n-1) and try every position of b0, say fix b0=i.Then reconstruct p from pi=b0^(saved query(i, 0) value). Finally, check whether it is a valid permutation and consistent with the queries.

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

      Er...set b0 to i?Are you mean that assume b0 is i,then Query(0,0-n-1) and Query(0-n-1,0)...?

      It seems good...But how to construct all the p values or determine the value of the true b0...?

      Sorry for my late reply and my low intelligence...

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

        Let Q0, Q1 be arrays of length N and Query(X, Y) be query value — i.e. P[X] xor B[Y].

        We can save Q0[i] = Query(i, 0) and Q1[i] = Query(0, i) for all 0<=i<N.

        Then the brute force begins.

        1. We fix b[0] = k

        2. We can reconstruct P by setting P[i] = Q0[i] xor k.

        3. Now we check whether P is a valid permutation.

        4. If it is valid, then we check P against our saved queries, namely Q1.

        5 Repeat from 1 to 4 for all 0<=k<N.

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

I think div.2E is a problem of combination number,but I can't get the solution.

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

Div.2D: I wrote all my queries to stdout and flushed, then read the all of the answers one by one, and my submission got an ILE? Somebody wrote one query to stdout and then read the answer at once, then he passed the pretest? Is it my fault? My Submissions:

cstdio version

iostream version

Practice submission(query and then read at once):

Practice version

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

del

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

    На прошлом раунде взяли 100 человек, так что еще неизвестно )

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

I submitted solution to B after hack to my solution which got accepted. To recheck it i submitted my previous solution again and it showed the wrong answer. Now my solution (correct one) is not getting evaluated. Will they not consider my correct solution. :( EDIT : They evaluated it :)

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

NOOOOOOOOO!!!!!!!In Div2 D During the contest I read the answer of 2*n times together and I got an ILE…… After contest I tried read every answer after questioning I got AC …… Oh my goodness……

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

How to solve Div.1 E?

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

    I think the main problem is constructing compressed tree for that k vertices. I remember it is to solve this: https://open.kattis.com/problems/optimistan.

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

    Pick a pair of special vertexes U,V that are as far from each other as possible. Construct a chain that connects them (these are the points with d(U,W)+d(W,V)=d(U,V) ordered by distance from U). Consider subtrees rooted at each vertex from this chain. We can easily split all vertexes into these subtrees. The distances to each vertex X from X's root Y equals to d(U,X)-d(U,Y). So we may treat roots as special vertexes. Most of subtrees will have only one special vertex — the root. They may be processed in O(N) in total. For the other subtrees we recursively call the same procedure.

    This process seems to terminate quickly. On every step each subtree will lose 2 special vertex, but it may possibly generate some new. The more subtrees there are, the faster the special vertexes are lost. It seems all vertexes will be processed in O(K) iterations and problem is solved in O(KN).

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

В задаче B(div2) проходят решения, выдающие ответ 1 или 3 на тест 3 2 3 3 1

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

Good, lucky problems, good contest as well as author!

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

My screencast

Hope you find it interesting!

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

For problem B

for k==2 how is it max(a[0],a[n-1])

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    1. Seeing, that you can achieve it, is pretty easy. You can take that one element as one segment, and the rest as the other.

    2. Let's assume we achieve an answer x such that x > max(a0, an - 1). If this element is in the first segment, then the first segment's value should be x, but since x > a0 the score will be at most a0. Same goes for the second segment, so x can be in neither segment, which is contradiction.

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

    Splitting of array a of n elements into 2 subarray,it must be a prefix and a suffix. for the minimum to be larger, we make the 2 subsegments [0,n-2] and [n-1, n-1] or [0, 0] and [1,n-1]

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

      subsegment can be:

      [0,n-3][n-2,n-1] like that...

      why these two??

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

        2 subsegment : [0, x], [x+1, n-1] (0 <= x < n-1)

        the answer is max(mininum in [0, x], mininum in [x+1, n-1])

        so :

        mininum in [0, 0](it is a[0]) is larger than mininum in [0, x]

        mininum in [n-1, n-1](it is a[n-1]) is larger than mininum in [x+1, n-1]

        when a[0]>a[n-1] a[0] is larger than mininum in [0, x] and mininum in [x+1, n-1](for each x : 0 <= x < n-1)

        when a[0]<a[n-1] a[n-1] is larger than mininum in [0, x] and mininum in [x+1, n-1](for each x : 0 <= x < n-1)

        so for the minimum to be larger, we make the 2 subsegments [0,n-2] and [n-1, n-1] or [0, 0] and [1,n-1]

        sorry, my English is not very good, but you can try to understand it. :)

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

Oh..There are so many hacks today! You see There are about one thousand and seven hundred people solved ABC during the contest. So do I. But my solution for B got a FST... Because I defined the mininum by -1e9+7 instead of -(1e9+7).. But I still got rank 180..Because I hacked eleven people :P

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

Will there be an editorial?

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

http://codeforces.com/contest/872/submission/31353320

check this solution for Div2D.

When something likes "5000 xor 4191" happens, will it get Runtime Error ? I think it will

but why it didn't happen ?

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

Is the editorial published ?

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

How you guys came up with Div2-C . I mean is it writing bruteforce than generalizing it Or there is some other way to approach for solution?

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

    I will try to explain a possible approach.

    First, if you want to represent n as a sum with lots of summands, those summands have to be small. Therefore you should ask yourself, what is the smallest suitable summand? It is 4. Can you use only 4? Only if n % 4 == 0. What about the other remainders modulo 4? You are obliged to use something else apart from 4.

    The next composite number is 6. You can see that if n % 4 == 2, using one 6 and all 4 is optimal. But you cannot obtain any odd n using only 4 and 6.

    Hence you need to use one more number. Maybe 8? No 8 is not useful as 4+4=8. Maybe 9? Yes! Using one 9 and all 4 you can obtain all n % 4 == 1.

    The only remaining case is n % 4 == 3. Can you get it using only 4, 6, 9? The answer is yes as 6 + 9 % 4 == 3. The issue is that this is no more trivially optimal and you have to check the optimality. However, checking it is super-easy, as the smallest useful number (i.e. it is composite and it cannot be generated as a sum of 4, 6, 9) is bigger than 6+9 = 15 and therefore using 6+9 is optimal if n % 4 == 3.

    p.s. I have ignored all small cases. As a byproduct of the explanations I have given ,those are all impossible (1, 2, 3, 5, 7, 11).

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

Очень понравился раунд, условие хорошо написаны,без воды, которая непонятно зачем вообще нужна.И задачи красивые

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

Ну так что, проходят первые 100?

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

And how many participants went to the final?

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

Does anybody know why I receive "Denial of judgement" for sources 31428657 and 31428722 ? The error on test 88 is : Can't compile file: Compilation process returned error: execution failed because of unknown invocation error