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

Добрый день!

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

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

Параллельно с Отборочным Раундом будут проведены открытые рейтинговые раунды для обоих дивизионов, в них могут принять участие все желающие.

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

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

Зарегистрироваться на олимпиаду →
После регистрации на олимпиаду не забудьте зарегистрироваться на Отборочный Раунд!

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

Авторы отборочного раунда; amethyst0, eidan, Diegogrc, bensonlzl, ruanxiaoyu, antontrygubO_o и KAN. Спасибо antontrygubO_o и 300iq за помощь в координации. Кроме того, огромное спасибо тестерам, без помощи которых этот раунд не состоялся бы: Golovanov399, kalki411, malachi_toney_goat, dantrag, Retired_cherry, gigabuffoon, Andres_Alumets, firi., coderz189, Nero, GGMU, K0u1e, Bench0310, dorijanlendvaj, Um_nik, thenymphsofdelphi, Merkurev, kokokostya, wucstdio, smile_boi, abhishhh1!

Для тех, кто впервые на Codeforces: в таблице ниже вы можете найти примеры решений на всех поддерживаемых языках:

Группа языков Языки программирования / компиляторы Примеры
C GNU C, GNU C11 10903473, 17029870
C++ GNU C++, GNU C++11, GNU C++14, GNU C++17, MS C++, etc. 23794425, 5456501
C# Mono C#, MS C# 3195513, 3794163
D D 5482410, 2060057
Go Go 7114082, 21366098
Haskell Haskell 455333, 1668418
Java Java 8 25491359, 23678167
JavaScript V8 35963909, 35681818
Kotlin Kotlin 25779271, 25204556
OCaml OCaml 6157159, 1281252
Pascal Delphi, FPC, Pascal.NET 1275798, 1259434
Perl Perl 2519448, 1277556
PHP PHP 413942, 35875300
Python Python 2, Python 3, PyPy2, PyPy3 35883730 (Py2), 36179112 (Py3)
Ruby Ruby 1837970, 1289551
Rust Rust 25180002, 35652442
Scala Scala 35847980, 2456025

Удачи!

Спасибо за участие! Поздравляем победителей:

Технокубок 2021 - Отборочный Раунд 2

  1. Kirill22
  2. fastmath
  3. VEGAnn
  4. alexxela12345
  5. solver777

Codeforces Round 687 (Div. 1, основан на Отборочном раунде 2 Технокубка 2021)

  1. ecnerwala
  2. ainta
  3. Konijntje
  4. al13n
  5. kort0n

Codeforces Round 687 (Div. 2, основан на Отборочном раунде 2 Технокубка 2021)

  1. Sharpness
  2. iLoveIOI
  3. Linqi05
  4. xaohu
  5. detect

Upd: Рейтинги пересчитаны.

UPD2: Опубликован разбор задач.

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

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

Notice the unusual start time!!!

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

Notice the unusual time.

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

please upvote me , i am getting too many downvotes !! please push me to a +ve side !!

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

Why the unusual start time?

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

Today is my Birthday and I enjoyed testing this amazing round on my birthday. Problems are very very interesting. (May I get my gift now, you know what I want)

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

This competition is friendly for Chinese competitor! Thanks KAN!

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

Pacific time zone people are probably celebrating, lol, better than waking up at 6am in the morning.

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

I'm sorry to hear that. I will miss the contest. I will not at home tomorrow afternoon because I have to participate in a competition in my school. (-_-!)

Have fun and good luck!

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

Score distribution?

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

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

Nice contest, thanks KAN and your team !!!

Goodluck to everyone ^_^

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

As a tester, doing it for the first time, I have to say that preparing a round seems like an enormous amount of work by the problemsetters and coordinator. Much more work than I imagined. Huge respect for everyone who makes rounds happen, even when something goes not as planned!

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

A great time for Chinese competitors! I won't miss this round :)

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

... please register at Technocup 2022 website and take part in the Elimination Round.

Do you mean Technocup 2021?

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

Can the string hash to O(1) to compare the dictionary order size

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

What will be the difficulty level of this contest (div2) ???

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

Thanks for starting contest not in dawn.

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

To be honest every round is the birthday of ~50 people participating

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

Russian students are very lucky. They get introduced to programing at a very early age! As for us, country like Bangladesh India Pakistan, we rarely get to know what is programing before university! Hope one day it will be changed! Good luck everyone.

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

What if I had registered and won't be able to participate? Because I am not sure whether I would be able to participate?

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

When Scoring distribution will update?

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

First of all, how many tasks are there...?

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

just a simple question regarding contests : once I submitted solution and got WA on pretest 1 and still I didn't get any penalty!! Is it true to say that if I fail on the sample test cases then no penalty will be there?

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

I'm a simple man. I see anton, I take part.

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

Is everyone getting Queued in their submission? If so, what is the issue?

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

KAN Great contest sir... Loved it.

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

khó v pip thằng nào ra đề đấy

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

khó v pip dm

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

This queue is a joke... spending ~3-5 minutes just to see if your submission is wrong isn't fun when you're really on the edge to solve a problem. EDIT: now more than 5 minutes:)

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

:( The queue is bad today

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

Will the contest be extended or will any other measures be taken, because the queue is pretty bad?

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

I was solving wrong C, thought that you could remove any element :(. Realized it in the last 10 minutes. But I think i managed to get correct answer.

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

What is test case 9 of D Div2 / B Div1?

Upd: got it.

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

there was a queue of around 5 minutes in end and the round wasnot extended this waas the only problem I faced with this round!

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

How to solve D(div2)?

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

how to solve problem D? I just bruteforce and passed sample...

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

Did anyone else face a queue in the last minutes of the round ?

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

What is the hack for Div1B ?

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

At the last moment, I was facing In queue prblem :(

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

How to solve div2-D?

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

    If n > 60, answer = 1; else Run brute force. I did in O(n^3) brute.

    For the first condition, by Pigeonhole principle, there will be atleast 1 bit which is the most-significant-bit for 3 consecutive numbers. Choose the later 2 numbers from them and perform operation on them, their xor-sum will be less than the earlier number from them. So the answer will be just 1 move.

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

What are hack cases for div1B?

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

I submitted C in last 2nd minute but the judgement didn't came in contest. If it gets passed. Will it be considered in rankings or not?

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

Hey, I submitted the solution of problem C 5 minutes before the contest was going to get over, but it remained in the queue till the contest ended. Will my solution be judged? plz help

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

There was 5-7 mins queue in last 10 mins. Round should have been extended. :(

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

hey i am new at recursion..so i was trying to solve problem c in div 2(Bouncing Ball).i was using this recursion-> ll aa( ll i) { if (i >= n)return 0; if (s[i] == '0') { return min(y + aa( i + 1), x + aa( i + k)); } else return aa( i + k); } it passed me the given test case but i got TLE in pretest 2.i know i have to use dp or some other approach to imporve time . but i was thinking is my recursive approach is right or wrong .can some one help me if it is wrong what would be the recursion? any kind of help is appreciated. (sorry for bad english)

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

Regarding the queue: unfortunately during the last 5 minutes of the contest the queue was around 5 minutes due to huge number of submissions. I understand this is not very convenient, but we decided not to modify the length of the contest due to the following reasons:

  • This delay is not that large considering the total contest time.

  • Extension of the contest can bring a longer queue anyway.

Sorry for inconvenience, we hope for your understanding.

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

what is the approach for Div2-C ?

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

    One of the solution is as follow : let us iterate over all possible values for the index where p will hit, i.e. if we don't remove anything from start and we have 0-based indexing, then we will hit on p-1, if we remove 1 from starting we will start at p, if we remove 2, then at p+1 and so on.

    So, if I know the starting point, what I would like to know is, going forward at interval of k, how many 0s, we will be hitting. This part can actually be stored first.

    So, pseudo code

    initialize an array of size k to 0, a[k]
    res = n*x; // if we have all 0s and we change all of them to 1, worst case
    m = 0, 
    for i = n-1 to p-1
      if s[i]=='0'
        a[m%k]++;
    
      // let us try to put p at current index 
      cost = (i+1-p)*y + a[m%k]*x;
      res = min(res,cost)
      m++;
    print res
    
    • »
      »
      »
      5 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      '''

      3 10 3 2 0101010101 2 2 5 4 1 00000 2 10 11 2 3 10110011000 4 3

      '''

      n=int(input()) for i in range(0,n): o=input().rstrip().split(' ') p=input().rstrip() s=input().rstrip().split(' ') x=list(p) L=[] Q=[] W=[] S=[] D=[] for j in range(int(o[1])-1,len(x)): if j not in L: L.append(j) Q.append(j) S = 0; for k in range(j,len(x),int(o[2])): L.append(k) if x[k]=='0': S+=1; W.append(S) # print(Q,W) mini = 10000000000000; for j in range(0,len(W)): A=Q[j]+1-int(o[1]) T=int(s[1])*A; T+=(int(s[0])*W[j]) mini = min(mini,T) print(mini)

      my O(N) solution

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

Nice contest. Nice problems. Managed to solve 2 Good Going

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

That feeling when you solve the problem 5 minutes after the contest.

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

why was their so much of queue time? my 2 solns were in queue for more than 8 mins?

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

Why this solution passed in Div1B/Div2D its complexity is O(n^2). It should get TLE?

  • »
    »
    5 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +14 Проголосовать: не нравится
    for(int i=3;i<=n;++i)
    {
    	if((a[i]^a[i-1])<a[i-2])
    	{
    		puts("1");
    		return 0;
    	}
    }
    

    This block will return answer if there are atleast 3 numbers with same most significant bits.

    So, for each most significant bit, there can be atmost 2 numbers. For $$$a_i \leq 10^9$$$, there are at most 30 bits, so $$$N \leq 60$$$ holds.

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

I'm going to FST in B. Very sad times. Otherwise I might +100 according to the predictor....

The case for me to FST:

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

good problem set

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

f*ck B pretests

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

How to solve Div2 B?

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

How to solve D? (Edit : I was thinking of prefix and suffix xors, and I see some people talking about it in the thread. But I was not able to prove it. So didn't code.)

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

    I think the idea is to create a prefix xor array $$$p$$$ and now we need for each $$$i$$$

    $$$p[j] \gt v[i+1] \oplus p[i] \ j \lt i$$$.

    So you need the $$$min(i-j)$$$ over all $$$i,j$$$. And update the answer doing the same on the reversed array.

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

It seems that D1B has too weak pretests and clearly I'll fst...

upd:TEST 51 is GOD!

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

Why wasn't there additional time after such a long queue? It's so unfair. :)

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

Did anyone else face a queue in the last minutes of the round ?... My solution was in queue even when the contest was over... !!

Is it fair?

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

B was the only good task in Div1 (possibly other than E), but you managed to ruin it with disgusting pretests

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

How to solve div2E/div1C?

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

Can D be solved with trie?

using prefix and suffix we can insert them into different tries, and then with each index we check using dp on the trie of the suffix: the minimum index which makes the current xor smaller than v[index-1], and we do the opposite for the prefix.

is there anything wrong with this idea?

i saw many people solved it in an easier way but i think this solution might be interesting.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится
Even Contest is Over But In Queue
»
5 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится -18 Проголосовать: не нравится

might not will happen in future :(

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

[deleted]

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

Nice contest. Problems were really good comparing to previous rounds.

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

Can someone explain why in div2-B O(n*100) will not give TLE given the time limit is 1 second.

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

Thanks KAN for the time that friendly for Chinese OIers.
I hope I would not FST and become CM!
update:I got an FST on div2 D ...... But it seems that I can still become CM?

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

Make It Unrated .

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

for DIV 2, Last problem, NEW GAME PLUS! I found some issue with the third pretest,

13 2

3 1 4 1 5 -9 -2 -6 -5 -3 -5 -8 -9

the answer I calculated by logic is 70, yet the output given is 71,

can anyone please explain this pretest?

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

Div2D/Div1B is ruining the ratings of many. xD

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

I also FST on D. ??????

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

I passed the pretest but failed in the system test for Div2B. Is there any way for me to improve code efficiency?

https://mirror.codeforces.com/contest/1457/submission/99863237

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

Could you just use brute force for div2D/div1B? My approach got 46ms on tests up to 45 but WA on it: https://mirror.codeforces.com/contest/1457/submission/99889304

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

what's with the weak pretests!!

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

I feel the luckiest person on Earth.

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

WHy this submission is WA Instead of RUntime error. If some index is out of vector size why I got WA . the same submission when I increased length of the vector passed easily. AM I missing something with properties of vector.

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

Very WEAK Pretests!!!

FROM +100 TO -100, for an obvious mistake and an INTEGER OVERFLOW issue.

Though it is me that wrote the FST code, how can pretests be SO WEAK? I AM ANGRY!

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

Finally going to be violet It seems
Most likely this wouldn't happen without mass-FSTs, so I waited for them, and they came to me. So sweet :3

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

waiting for editorial

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

Is the following solution for Div2 D correct, or are the system tests weak? (this gets OK and passes the system tests)

#include <vector>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <climits>

int main()
{
	int n; std::cin >> n;
	std::vector<int> seq(n);
	for(int& x : seq)
		scanf("%d", &x);
	int ans = INT_MAX;
	for(int i = 0; i < n-1; i++)
	{
		int lxor = 0;
		for(int left = 0; i - left >= 0 && left <= 32; left++)
		{
			lxor ^= seq[i-left];
			int rxor = 0;
			for(int right = 0; i + right + 1 < n && right <= 32; right++)
			{
				rxor ^= seq[i+right+1];
				if(lxor > rxor) ans = std::min(ans, left+right);
			}
		}
	}
	printf("%d\n", ans == INT_MAX ? -1 : ans);
}

The code iterates over the location of the potential decreasing pair of elements, and tries applying the XOR gun at most 32 times at both endpoints of the pair (and if the XORs are decreasing, updates the answer).

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

    Yeah, it is correct I think
    Range of length 66 is guaranteed to contain at least one triplet with the same most significant bit. And if you have such a triplet, you can solve the task for one move

    And if the answer is bigger than 1, you basically do bruteforce

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

    First of all, in order to keep the comment section readable, please don't post whole code here...

    Yes, this solution is correct, although it may sound weird in the beginning. For this, suppose there are 3 integers in the array with the same leading bit. Because the array is sorted, if there are three, then there are three consecutive. Then by xoring the second and the third, the resulting number will have this bit off, and thus will be smaller than the first number (of the three we looked at). Thus if the answer can only be bigger than one if $$$n \leq 2 \cdot log(max(a))$$$, which in this case gives $$$n \lt 60$$$. But in this case, your code bruteforces all the possible ranges, and will find the best groups.

    EDIT: As mango_lassi pointed out, I don't really see why it's correct if the bruteforce only checks sets with size up to 32...

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

      Shouldn't the loops go up to 60 for the code to brute-force all possible ranges? What if, there was somehow a case where, say, $$$n = 41$$$ and you need to xor the first 40 to make them larger than the 41st number?

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

        True, I didn't think that far, I only saw the bruteforce...

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

        I wonder what is the actual worst case here? Skimming through the system tests, it looks like 29 is the largest answer?

        Can somebody show how to get more strict upper bound of log instead of 2*log?

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

          Let's say we have one number for each most significant bit

          And now we add one more for one of the bits

          So we have a pair (A, B)

          Now look at A^B

          If it doesn't create an answer immediately, it joins the neighboring bit on the left

          So if we count numbers by the most sign bit and we have something like
          [1,1,1,2,1,1,1,2]
          It is already enough to create a decreasing sequence
          [1,1,1,2,1,1,2] -> [1,1,1,2,1,2] -> [1,1,1,2,2] -> [1,1,1,3] (log + 2) numbers seems enough to gurantee the existence of the triplet with the same sign bit.
          And there will be no more than log operations before we stop

          So it seems it is rounddown(log n)

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

any hint for [problem C] and thank u

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

What was there in test case 51 of div 2 problem D? Many people got a wrong verdict on that testcase.

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

Why D is O(n^3) and not TLE??? My own computer TLE

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

Got stuck on B , such an easy problem

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

Can anyone tell me why my solution 99882642 is giving Runtime error on pretest 3. I have checked it by giving the input present in pretest 3, and it is giving correct answer.

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

https://mirror.codeforces.com/contest/1457/submission/99878780

Can you please help me figure out reason behind TLE? IN TC 30/33

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

Where's the editorial

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

Have you guys seen anyone going from CM to GM in one contest ? check this

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

Hi, it's my first contest, will I get any rating for it? If yes when? I solved 1 problem so I have some points.

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

(images.jpg)

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

Can someone provide me a hint for DIV2.C??

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

An amazing round , I enjoyed tasks so nice and helpful.

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

why there is a huge gap in div1 rounds its just so annoying : (

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

I think the round is very good !

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

Any comments about div1D? I like the idea, although at least in my $$$O(N)$$$ solution, it's very easy to make a small mistake in implementation even when you know what to do. My solution is DP with states "if the clone just took $$$i$$$, where can I be?" and "if I just took $$$i$$$, where can the clone be?"; it turns out that in the second case, the set of possible positions is a range around $$$X_i$$$, which forces the set of positions in the first case to be at most a union of two ranges.

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

If anyone is stuck at C , you can watch this https://youtu.be/_yErO-xE1O0

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

I used dictionary tree to passed the div2 D, I can guarantee its correctness, but I can't guarantee its time complexity,can anyone hack my solutions? https://mirror.codeforces.com/contest/1457/submission/99900717

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

please, someone help me to understand problem div2/D,, why the answer is 1 when the value of n > 60??

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

    Consider elements of the same highest bit. Some examples are [2(10), 3(11)] and [4(100),5(101),6(110),7(111)] and so on. 1e9 has has 30 bits so there are 30 different such groups.

    Now consider if a group has 3 elements from the given array, for example [4,5,7]. Since their highest bit is the same, if i xor any 2 of the value, the highest bit becomes 0 and the resulting number belongs to a lower group. if i xor 5 and 7, 101^111 gives 2(10) which is less than 4. So basically is theres 3 numbers in a group the strategy is to xor the last 2 in the group and we're done. So each group can have at max 2 numbers and hence we get 30*2=60.

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

    There is a feature called "spoiler". look

    spoiler

    Please remember this. It's crucial that you understand this feature. I didn't want to know that " answer is 1 when the value of n > 60", cause I wanted to try and upsolve this problem!

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

Why were rating changes rolled back?