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

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

Добрый день!

В 01.06.2019 17:35 (Московское время) состоится Codeforces Global Round 3.

Это третий раунд из серии Codeforces Global Rounds, которая проводится при поддержке XTX Markets. В раундах могут участвовать все, рейтинг тоже будет пересчитан для всех.

Призы в этом раунде:

  • 30 лучших участников получат футболки.

  • 20 футболок будут разыграны случайным образом среди участников с 31-го по 500-е место.

Призы в серии из 6 раундов в 2019 году:

  • За каждый раунд лучшим 100 участникам начисляются баллы согласно таблице.

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

  • Лучшие 20 участников по итоговым результатам получают толстовки и сертификаты с указанием места.

Задачи для этого раунда были разработаны мной, kiyotaka и Jatana. Мы приготовили для вас 8 идейных задач и надеемся, что они вам понравятся!

Спасибо KAN и cdkrot за помощь в координации раунда, а также cookiedoth, Lewin, voidmax, 300iq, Aleks5d, Learner99, Jeel_Vaishnav, arsijo, KAN, Ashishgup, AlexFetisov, vintage_Vlad_Makeev за тестирование!

Удачи!

UPD. 1:

Here are a few words from the sponsor of Global Rounds, XTX Markets.

Hello, I’m Yuri Bedny from XTX Markets! While studying at university I actively took part in programming contests and later got to apply these skills at XTX Markets. Our office in London (UK) is looking for candidates for two open positions. We hope it will be interesting for some of you to apply your skills and knowledge in problems we are solving. I wish good luck to all the participants and hope you’ll enjoy the problems.

Open positions at XTX:

  • XTX Markets is looking to expand its Java team. You’d be expected to be able to design low-level data structures and algorithms to fit particular performance characteristics. We have a direct impact on profits and very little bureaucracy and are open to candidates with no financial experience. Read the details via the link.
  • XTX Markets is hiring into its Core Development team in London. This team is responsible for the design and implementation of the platform that provides a broad range of post-trade functionality essential to the firm’s business. This complex, distributed system has been developed in-house using a distributed microservices architecture to provide high throughput (thousands of trades per second) and high availability (24x7 operation) while also allowing very agile but well-controlled development practices (multiple production releases per day). The system is implemented primarily in Go, but prior Go experience is not required for those willing and able to learn quickly. The only necessary skills are exceptional programming ability, a passion for solving real-world problems, and a dedication to rigorous software engineering. Read the details via the link.

If you are interested in these positions, then fill out the application form via the link or during registration for the competition.

UPD. 2:

Разбалловка: 500 — 1250 — 1500 — 1750 — 2250 — 3000 — 4000 — 4000. Раунд продлится 2 часа 15 минут.

UPD. 3:

Текущие результаты всех Global Rounds.

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

  1. mnbvmar
  2. tourist
  3. Petr
  4. yutaka1999
  5. LHiC
  6. Egor
  7. ksun48
  8. sunset
  9. krijgertje
  10. kczno1

UPD. 4:

Разбор.

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

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

Another rated round after a long break! Yeah!

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

Автокомментарий: текст был обновлен пользователем kiyotaka (предыдущая версия, новая версия, сравнить).

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

Hope it will be a balanced contest. Not like the previous one :)

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

deleted :(

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

Where is the number of problems and score distribution?

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

Hope everyone can have a good performance! (and hope I can get red again)

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

Hi, new member of the CodeForces community here. Looking forward to participating in the contest and getting a good rating and learning cool stuff. Wishing everyone the same too!

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

I'm interested in XTX Markets job but are they interested in me XD ? (I know the answer don't tell me)

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

I like global rounds (I didn't entered any of them)

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

Do global rounds support hacking? if yes then, during or after the contest?

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

Are there remote jobs at XTX Markets?

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

Here we go!!

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

How many problems will be shown

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

1.. 3.. 5.. 7.. 9.. Finally!! the contest season is back!

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

hopes this contest will bring happiness in our life

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

round will be rated for those who have not solve anything?

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

Why you don't thanks MikeMirzayanov for amazing systems Codeforces and Polygon! ?

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

Why I was told that too many request and couldn't submit my code?

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

JOJO's Bizarre Adventure? That's pretty cool!

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

Is this a JoJo reference ?

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

Problem D was easier than Problem C. Am I the only one who felt that way?

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

Regarding problem F, is it true that there will always exist at least one $$$s$$$ with not more than $$$2$$$ bits being set? :O
My solution only checked for those (and their compensation, just in case) and got Pretest passed :O

UPD: It did fail at test 49. GG. :D

UPD2: My source code was actually screwed up a bit. Still AC after fixing some bugs and optimizing a bit. ;) (54974178)

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

    One case I can think of is an array with all elements equal(of size 60 or so) and maski has the ith bit set.

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

    No. Suppose that we have one object for each mask with exactly two bits set, and that each object has value 1. If we use an s with at most 2 bits set then only a small fraction of the objects will have their values negated, so the sum will still have the same sign. And the same thing happens for all s with 60 (or more) bits set (this was what you meant by compensation, right?).

    But if you're lucky such a case won't be in the system tests. :)

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

How to solve F?

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

    Maintain sum and try to randomly switch bits?

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

      I did this, and my rationale about this solution was that the expected value of the sum is 0 because every number will flip the sign with probability 1/2. But since expected value is only average there might be the case that there a lot of small positive numbers reachable and few large negatives. In this case, random search can fail. I'm not sure if random search is a expected solution for this problem, and I will be happy to hear if it is a valid solution, why it is expected to work on time (with high probability).

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

    I passed the pretests with following algorithms:

    Repeat this operations until you find an answer.
    1. Choose value s randomly between $$$1$$$ and $$$2^{62}−1$$$.
    2. Check the total prices. To calculate, it usually takes $$$O(NlogN)$$$, but if you use __builtin_popcountll (if C++), it takes $$$O(N∗C)$$$ and $$$C$$$ is around $$$5$$$.
    3. If the sign of total prices has changed, you successfully found the answer.

    On average, you should do $$$~2$$$ operations. Is there any doubt that there is some cases that the sign of total price changes in very less percentage of $$$s$$$? I think it's not. I checked $$$100,000$$$ random cases which the value of mask is between $$$1$$$ and $$$63$$$. The worst case was the sign of total prices changes in $$$8/63$$$ of s assume s is also between $$$1$$$ and $$$63$$$.

    P.S.
    The testcase which the sign changes with only $$$8$$$ out of $$$63$$$ $$$s$$$ is as follows:

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

How to solve E?

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

what the hell is pretest 14 on E ?

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

Too greedy contest

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

Problem H proved once again that Za Warudo's true power is, indeed, the power to reign over this world

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

what is test case 14 in problem E? why this code gets WA? 54943503

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

How to solve B?

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

Can someone please give hints for question: C. Crazy Diamond.

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

    Consider how to use no more than $$$5$$$ swaps to move number $$$i$$$ to position $$$i$$$.

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

      Hi! Im sorry I still did not understand it, can you or anyone please explain it. tia!

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

        You can find the positions of the numbers in the middle first. For example, if n=6, the order of numbers to find a position will be 3->4->2->5->1->6. When treats 3, if the original position>3, swap p1 and 3. And swap p1 and pn, and swap p3 and pn. If you do this way for each number, you can move each number to the correct position within three times. So the maximum number of the operation is 3n.

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

        Maybe there are simpler solutions, I will explain mine.

        1. $$$p_i=i$$$, we don't need to do anything. $$$0$$$ swaps.

        2. $$$abs(at_i-i)\ge\frac{n}{2}$$$, just swap directly. $$$1$$$ swaps. (Edited, should be $$$\ge$$$ but not $$$ \gt $$$)

        3. $$$i\le\frac{n}{2}$$$ and $$$at_i\le\frac{n}{2}$$$, use $$$p_n$$$ as temporary variable. $$$3$$$ swaps.

        4. $$$i \gt \frac{n}{2}$$$ and $$$at_i \gt \frac{n}{2}$$$, use $$$p_1$$$. $$$3$$$ swaps.

        5. otherwise, let $$$x$$$ be the lefter one in $$$i$$$ and $$$at_i$$$, $$$y$$$ be the righter one. Swap $$$p_x$$$ and $$$p_n$$$, $$$p_y$$$ and $$$p_1$$$. Then swap $$$p_1$$$ and $$$p_n$$$. Finally swap $$$p_x$$$ and $$$p_n$$$, $$$p_y$$$ and $$$p_1$$$. $$$5$$$ swaps.

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

Too Greedy Contest, the setters want to steal our rating :(

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

what is pretest 14 in problem E? why this code gets WA? 54943503

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

Please tell me problem F is not about trying different $$$s(hit)$$$ randomly...

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

    (retracted my previous claim; turns out there are counter tests)

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

    System test haven't started yet. I think they're trying to make that test :)

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

    Deterministic solution for F:

    WLOG assume sum positive, otherwise change all signs. Iterate $$$k$$$ from $$$61$$$ to $$$0$$$. For each $$$k$$$ and each $$$i$$$, sum $$$val_i$$$ over all masks such that the lowest on bit of $$$mask_i$$$ is the $$$k$$$-th. If this sum is positive, then turn on the $$$k$$$-th bit in $$$s$$$, otherwise do nothing.

    Proof this works: Consider a certain $$$0-1$$$ mask, and consider the expected value of the sum over all masks that have this mask as a prefix. (choosing a mask uniformly at random). All $$$i$$$ that have an on bit below the $$$k$$$-th contribute $$$0$$$ to this expected value, while the ones that are all $$$0$$$ below the $$$k$$$-th bit contribute $$$2^k$$$ times their sum. So our algorithm just forces the contribution for these to be always negative.

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

      I'm thinking for an hour also reading this but still don't know why this solution works. The fact that you're using the expected value in proof makes it not very convenient. So I'm assuming it's not something have to do with "random"s but couldn't figure out.

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

        Yeah, the expected value is just for convenience, the solution isn't random. In a bit more detail:

        For a mask $$$m$$$ with length at most $$$62$$$ let $$$f(m)$$$ be the expected value of the sum described in the problem if we choose a mask uniformly at random from among the masks of length $$$62$$$ that have $$$m$$$ as a prefix. (Using sum or average instead of expected value would give the same argument, I just found expected value clearer). By the linearity of expectation we can expand

        $$$f(m) = \displaystyle\sum_{i = 1}^n \displaystyle\sum_{s}\mathbb{E}\left[val_i \cdot (-1)^{popcount(s, mask_i)}\right]$$$

        Where the right sum goes over all masks of length 62 that have $m$ as a prefix. In particular for masks of length $$$62$$$ this is just the sum in the problem statement, which we want to make negative. So basically we build each digit of the mask while decreasing or keeping the expected value the same at each step. Initially the expected value is $$$0$$$, so this way we do get an answer at the end. The main claim is that the expected value for a certain $$$i$$$ and $$$m$$$ is $$$0$$$ if $$$i$$$ contains some $$$1$$$ after $$$m$$$, and $$$2^k \cdot val_i$$$ otherwise. This is because half of the masks with prefix $$$m$$$ have $$$popcount(s, mask_i)$$$ odd and half even as long as there's at least one on bit after $$$m$$$ (basically just restating that a set has the same number of odd size subsets as even size).

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

          Okay, thanks for answering again. But still, I'm not sure about some parts. Do you prove that it'll be negative in the end? Or do you show it just decreases or stays the same in each iteration?

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

            I show that it decreases or stays the same. At the start it's $$$0$$$ because all masks have at least one on bit, so the end result is negative unless it never decreases. But if it never decreases then the sum of everything must be zero, which is false.

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

        The way I think of it is like this:

        Go through the $$$(value_i,mask_i)$$$ and group them depending on which bit is the last 1 bit in the mask.

        What juckter's soution does is making it so that the sum of values for each of those groups is $$$\leq 0$$$. He does this by doing the operations in a smart order, starting with mask 10000000 and then doing X1000000, then XX100000, ..., ending with XXXXXXX1. Note how modifying bit k doesn't change the contributions from groups 1 to k-1. This way he can make the contribution from each group be $$$\leq 0$$$.

        Also because the sum of everything in the beginning is $$$ \gt 0$$$ at least one of those groups must after running the algorithm have sum of values $$$ \lt 0$$$. One way to see this is proof by contradiction, assume that after doing the algorithm all groups have contribution $$$= 0$$$, that implies that they also initially all had contribution $$$= 0$$$ which is a contradiction.

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

        After reading mnbvmar's solution, here is the intuitive approach I got:
        Asume the sum of all the elements to be positive, otherwise change all signs.
        Iterate current_bit from 0->61
        Let the sum of all the values with current_bit as the highest set bit be current_sum
        Now, the values with higher set bits in their mask can be manipulated later on, but the ones contributing to current_sum cannot, because they are not effected by toggling higher bits in answer.
        So, if current_sum is positive, we must greedily toggle the current_bit in our answer, and then negate the values of all the masks having current_bit set as 1.
        This way, we will make sure that at each iteration, all the numbers with highest set bit as cuurent_bit sum up to non-positive number.

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

    I have a algorithm (not random) for problem F. Haven't tested it yet, but I think It's correct.

    Let's split A (the origin set of objects) into two subsets: A1 and A2. All masks in A1 have the bit 0 turn off, and A2 = A\A1.

    Suppose we have someway to assign bit 1, bit 2, ... such that sum of all val in A1 is non-negative. After assign bit 1, bit 2, ..., we have two option: turn off bit 0 or turn on bit 0, one of them will make the sum of A2 is non-negative. So, we found a way to assign bit 0, bit 1, ... such that sum of A is positive.

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

    I think that tourist's solution is not that kind of solution.

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

10 seconds too slow to submit correct F :(

Too slow :(

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

Did somebody find a counter-test that makes random solution fail on problem F?

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

So many constructive and greedy problem!

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

any hints to b plzz??

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

How to solve B?

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

I would like to ask in problem C, how low can the amount of swaps allowed be, so there would still be a solution for every possible permutation?

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

Problem C:

You can solve this task in less than 3*n moves is this true?

Problem D: You partition the pairs into two sets: Set A: (pair.left < pair.right) Set B: (pair.left > pair.right)

You cannot use elements from both sets because of the following Suppose you use an element from set A then you have ....pair.left(A) < pair.right(A)

now if you want to append an element from set B you get

.....pair.left(A) < pair.right(A) > pair.left(B) > pair.right(B) --> not possible or

.... pair.left(A) < pair.right(A) < pair.left(B) > pair.right(B) --> not possible

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

The worst feeling in life: Waiting main tests with unproven random solution for F.

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

How could this solution get TLE 12? Just because of slow output? Thanks in advance.

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

it's my cake day so can i get 7 upvotes please

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

Problem C was great, very enjoyable to solve.

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

The difficulty gap between problem F and G. It was good for the other colors, but it was bad for reds.

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

I felt q(D) easier than q(C). Is there anyone who felt same ?

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

If mnbvmar did not get a hack in the last five minutes tourist was likely to have a new personal best rating.

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

Problem G would be pretty cool if the graph was given. That shit with bitsets ruined it.

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

Why so many people use random algorithms to pass F?

Are they really correct?

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

System Testing hasn't started; when will it start?

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

What's the upper-bound on number of operations in prbE.

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

What if in C we had to minimize the number of operations?

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

Any specific reason why submission 54926688 for B fails on pretest 8 ?

Is the general solution using two pointers wrong or have I missed an edge case?

Thanks in advance.

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

Codeforces Global Failed System Test Round .

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

There are literally 5 times more failed on main tests submission for F than Accepted.

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

Could somebody take a look at C 54937652? I have an O(n) solution that is getting TLed. Is this intended?

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

This contest be like: Pretests: Calculate 2+2 Main tests: The train goes 80 km/hours and you are writing programs. Calculate the mass of sun.

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

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

The most accurate description of pretests:

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

Problem C. Same code, replacing endl with \n. TLE with endl 54949525, Accepted, 452 ms with \n 54949838. This is awful :(

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

https://codeforces.me/contest/1148/submission/54936686. how it can be ml 38?! help me please

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

Actually problem F can be solved in various ways .

Including good-look random and check all 2^n and 2^n-1 then random. here

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

As usual, we used the following two files to determine tshirt winners:

get_tshirts.py
randgen.cpp

And the tshirt winners are:

List place Contest Rank Name
1 1148 1 mnbvmar
2 1148 2 tourist
3 1148 3 Petr
4 1148 4 yutaka1999
5 1148 5 LHiC
6 1148 6 Egor
7 1148 7 ksun48
8 1148 8 sunset
9 1148 9 krijgertje
10 1148 10 kczno1
11 1148 11 RNS_CUS
12 1148 12 betaveros
13 1148 13 ATS
14 1148 14 Reyna
15 1148 15 zeliboba
16 1148 16 khsoo01
17 1148 17 webmaster
18 1148 18 ainta
19 1148 19 Shanru
20 1148 20 Hazyknight
21 1148 21 Biden
22 1148 22 bicsi
23 1148 23 gisp_zjz
24 1148 24 renjingyi
25 1148 25 Alex_2oo8
26 1148 26 whzzt
27 1148 27 lumibons
28 1148 28 komendart
29 1148 29 scanhex
30 1148 30 receed
53 1148 53 Noam527
55 1148 55 KrK
97 1148 97 QAQT
107 1148 107 RobeZH
110 1148 110 Motarack
140 1148 140 darkkcyan
146 1148 146 GoGooLi
151 1148 151 Gassa
152 1148 152 Pigbrain
162 1148 162 J.J.T.L.
231 1148 231 saketh
272 1148 272 RCG
305 1148 305 Cirno_9baka
324 1148 324 Wechselhau
330 1148 330 danielykf
353 1148 353 Gullesnuffs
380 1148 380 matnakash
406 1148 406 spectaclehong
460 1148 460 fastle233
497 1148 496 Juney

Congratulations!

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

Why you rejudge some submissions even after the rating calculation?

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

This is the worst round I have ever seen. Terrible pretests. Problem writers made it purposely weak. Makeing bad pretests doesn't show the skill of the participants. I will never participate in these problemsetter's round. I made well in the contest, ended up losing a lot because of the stupid pretests. If you feel disapointed too, downvote the contest! (By a red user with fake account).

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

    You sure care a lot about a round you didn't compete in.

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

      I can say it not from fake account. I don't even know why people create fake accounts to show their opinion. Afraid of downvotes? I just got sad because of increadibly weak SYSTESTS on F and G.

      https://codeforces.me/contest/1148/submission/54952521 https://codeforces.me/contest/1148/submission/54950156

      How can this solutions even pass? That's so disappointing. It is the first wrong shitty idea, that you can come with. How is it possible to not test this out? Is that what meant in announcement by "8 tricky tasks for you"? That we must guess the tests? Or sorting by comparator and writing greedy algorithm on 2 pointers are "tricky" maybe?

      I didn't compete in first 2 rounds, but I already heard opinions that they were incredibly bad.

      I will for sure not participate in next global rounds, because in my opinion there are enough bad samples to not do it.

      By the way, why the round from XTX-markets is not prepared by XTX-markets employers if they are looking for people from CP community? Isn't that illogical? I wonder how many qualified high-rated people will they get after these rounds.

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

        Now I'm glad I missed registration by seconds and didn't feel confident enough to try with extra registration.

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

        There will be many accepted submissions (without proof) if they include up to 20 pretest.

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

        How can this solutions even pass? That's so disappointing. It is the first wrong shitty idea, that you can come with.

        Hmm, it was your third attempt and it was after the contest...

        Is that what meant in announcement by "8 tricky tasks for you"? That we must guess the tests? Or sorting by comparator and writing greedy algorithm on 2 pointers are "tricky" maybe?

        Problem F had an author's solution with induction, which I can call tricky. Also, problems G and H both had a deterministic solution without any random.

        Of course, it's not ok that such solutions pass systests. But in such problems like F or G there can be a very huge amount of strange unintended solutions and it's very complicated to create tests against all of them. In my opinion, weak pretests enable such tasks to exist. Maybe we should have warned about it in the announcment to make system testing not such disappointing.

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

I think this contest is really hard and unbalaced contest. I think that there should be more easy questions in the contests.

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

Codeforces Globle Fail System Test Round 3

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

Why is there no one asking for editorial?

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

Isn't Codeforces even try full feedback contests? Many other websites already use full feedback. Why does Codeforces use this system?

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

following is my code to the 2nd ques Born this way. I dont know about the correctness as I was getting Runtime error for the 1st TC. However the other two passed in the custom invocation.

Please tell me whats the problem here.

int main()
{
	ll n,m,ta,tb,k;
	cin>>n>>m>>ta>>tb>>k;
	multiset<ll> s1,s2;
	for(int i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		x = x+ta;
		s1.insert(x);
	}
	for(int i=0;i<m;i++)
	{
		ll x;
		cin>>x;
		s2.insert(x);
	}

	ll c = 0;
	multiset<ll>::iterator it,temp;
	for(it=s1.begin();it!=s1.end();it++)
	{
		ll x = *it;
		auto f = s2.lower_bound(x);
		if(f!=s2.end())
		{
			temp = it;
			s1.erase(temp);
			s2.erase(f);
			c++;
		}
		if(c>=k)
		{
			break;
		}
	}

	ll ans=-1;
	for(it=s1.begin();it!=s1.end();it++)
	{
		ll x = *it;
		auto f = s2.lower_bound(x);
		if(f!=s2.end())
		{

			ans = *f+tb;
			break;
		}
		
	}
	cout<<ans<<endl;

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

Can anybody please help to point out where I am going wrong in problem B it failed on 8th pretest

  1. Using the first flight from A to B I find the first flight from B to C using binary search .

  2. Now I have two options to cancel the flight

a. Cancel the flight from A to B and use the next Flight from A to B

b. Cancel the flight I found by binary search and
choose the next flight from B to C

  1. I find the time to reach C and which option between the above two gives higher value I go with that.

If in this process the next flight from B to C cannot be chosen I print -1.

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

    We can cancel atmost k flights. Start with value i=0 to i=k. Every time you will cancel i flights in A and You have to cancel k-i flight in B which firstly Available. n=10 m=10 t1=1 t2=1 k=3 A= 1 2 3 4 5 6 7 8 9 10 B= 3 4 5 6 7 8 9 10 11 12 If i=0 You have to cancel k flight in B which available for a [0] Every time you have to do same. I hope you got me.

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

Editorial?

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

Editorial??

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

Can anyone please check my following submission for Problem B and figure out what's wrong with it? I got a runtime error on test case 9, and my logic seems to be working fine for all cases I'm dry running it for. Thanks in advance! :) https://codeforces.me/contest/1148/submission/54942140

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

How to solve G? Or can anbody give me some hint for how to use gcd(ai,aj)>0 and 2k<=n?

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

    Find a spanning forest of the compliment graph. In the compliment graph if there are more than n/2 components then we have an n/2 clique in original graph. Else we can choose nodes only from components with size >=2 such that we take atleast 2 from each component we choose( can be proved that it is always possible to choose for any k st 6<=2k<=n ). In this set every vertex has an edge in the compliment graph, and hence this set is antifair.

    For finding the components, bitsets can be used to get a complexity of O( n^2 * MAXP /64) where MAXP is the max number of prime divisors of a number.

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

Oh,it's not very good to the participants who cannot submit any code in the first 10min like me... and I was sad when I saw that the score I got on each problem is less than the score 5min ago a lot after I submit each problem...(and I just need 3 point to go to the red! I wish I can get a red account in the next round...) All in all, it's a not bad contest, although it need "a lot of" constructive algorithms and basic tricks in the problem from A to E. F is an amazing problem with short words, but I can't solve it. Can anyone help me with it?

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

Разбор будет?

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

Can Someone explain how to solve C.

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

    Try order the array begining from the numbers that need to be at middle, so that, we can use the positions 1 and N of array to make swaps.

    If a number cant go to its right position, we can keep swaping it with position 1 or N until it can be placed to the right position.

    N = 8, order of verifications: 4, 5, 3, 6, 2, 7, 1, 8

    Ps: my english is not that good.

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

just curious why problem F is named Foo Fighters

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

54973406 My submission is Accepted after contest, but it's actually wrong. For instance, when get such inputs

6 3
18 75 245 847 1859 26

it outputs

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

Did anyone's randomized solution for F pass the systests ?

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

Editorial?, opening Codeforces after every 10 minutes just to see if editorial has been released.:-|

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

Solution for G that got accepted: 54972721 How??

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

Editorial for this contest please.

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

I made a silly bug in F and still got accepted 55273526, so I scanned through the first page of standings and successfully hacked an accepted deterministic solution. 54935870

kiyotaka Can you add these testcases to upsolving testcases?

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

Problems similar to Problem C, Crazy Diamonds

  1. 432C - Prime Swaps (Almost same statement)
  2. 1365B - Trouble Sort

It is interesting to note that this "temp variable" idea is repeated, and with each repetition the rating of the problem drops.