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

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

Привет всем!

Раунд состоится в четверг, 26 октября в 17:35 MSK.

Задачи подготовил я, Константин Хадаев. Это мой первый раунд на Codeforces. Спасибо zemen, AlexFetisov, vepifanov и Belonogov за тестирование, KAN за координацию раунда и MikeMirzayanov за этот сайт и за платформу Polygon.

Раунд продлится 2 часа. В каждом дивизионе будет по 5 задач.

Разбалловка: в Div 1: 500 — 12501250 — 2000 — 2500, в Div 2: 500 — 1000 — 1500 — 22502250

Всем удачного раунда!

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

Div 1:

  1. dotorya — решил все задачи!
  2. Um_nik
  3. jqdai0815
  4. V--o_o--V
  5. Errichto

Div 2:

  1. monsoon
  2. belkka
  3. Roooooo
  4. stasio6
  5. AngusRitossa
  • Проголосовать: нравится
  • +311
  • Проголосовать: не нравится

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

PS :- IT IS RATED -___-

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

Wow, Two contests in two days(CS Academy and codeforces) and written by the same author. I enjoyed the problems on CS academy, Hope they are good tomorrow too!

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

Is it rated means? I am new so i didn't understand what rated means.

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

    Its the most common "three words" you will find on the CF. Next common three words is "how to solve".

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

=i'll make a submission...

-What is the complexity of your code ?

= O(N^3)

-

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

    A could be quite reasonable depending on the problem. Consider the problem you are solving and the bounds, instead of making a sweeping statement on complexity.

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

Wish problem statements will be as short as this announcement. Wish everybody high rating!

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

Is it rated?

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

will it be available C#?

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

Codeforces Round #https.

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

Codeforces Round #https.

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

I want to describe this not only as a contest, this is an opportunity to explore new thinks for everyone, and this can give a handfull of distribution of our future succes so I wish good luck to everyone and PLUSES ^-^ at the end.!

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

Great!

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

    Simillar thing happened when I tried to login. I think server is very slow and unstable right now.

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

While registering, Error- "HTTP Status 403 -" :(

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

I was registered to the round, but now I see that I'm not registered and I can't register again (HTTP Status 403)

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

Apache Tomcat/8.0.46

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

Wow the scoring distribution is announced so early! I guess this is a non-"traditional" round...

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

Вот незадача! Хотел написать раунд а тут меня вызывают пожрать Шаурму весь классом.

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

Why the delay?

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

delayed))

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

Delayed again...

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

Delays, delays, delays :P :P

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

6000 reg only div2? Not bad :)

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

servidor is very slow today, hope the contest continue rated.

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

+10 min as usual

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

for the writer,pls be short!

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

Why test case 3 in div 2 C is 0? Is there no program? Thanks!

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

    it's empty

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

      its special :p !!

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

      I don't get it, man!

      (output => the length of your program)

      Why ^ 0 is not a program?

      Why empty program as output? (No program as output)

      Thanks in advance!

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

        It's the number of operations that your new function does before returning the value.

        For example, if k = 2:

        int modify(int value)
        {
           int value1 = value & 100;
           int value2 = value1 | 3;
           return value2;
        }
        

        If the k = 0, then you have the following function:

        int modify(int value)
        {
            return value;
        }
        
  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How did you know it was empty?

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

What is the hack for B?

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

How to solve Div-1 C and D?

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

    div1C
    Consider graph where there are edges from A -> B iff A can beat B , now consider each SCC in this , if a node can beat atleast one from this SCC and if atleast one from this SCC can beat this node , this node also belongs to the SCC , so an SCC can be characterized by mini and maxi which denotes min value of ith game strength of someone from this scc and similarly for max. This breaks the graph into a chain of SCC's , when you add a new node , find where it should belong in this chain , it will either belong complexity between 2 scc's or at the endpoint of the chain in which case just add this , or it will result in merging of a subarray in this chain into this node.

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

      "when you add a new node , find where it should belong in this chain"

      But assuming the worst case that at step #k you have k SCCs in the chain, doesn't this mean that the overall complexity becomes O(n^2*k)?

      There's probably something I don't understand in your explanation. Could you maybe elaborate just a little bit?

      Thanks in advance :)

      EDIT: ah, nevermind, you can probably keep the SCCs sorted for each k and use lower_bound() or something similar

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

Summary of my performance this round.

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

Ignore ...

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

Why i prefer dynamic scoring

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

what's wrong with this 31762295 for div2 B??

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

The problem C in Div. 2 was nice. Required a good bit thinking (atleast for me). My mind was blown...

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

How to solve div2 C ? Was it like taking Xor , and , or of all values and print in the same order. ?

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

    no that will not print the correct answer.

    Try in this input:

    |3

    ^2

    |1 Take x as 2.

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

      Thanks , Then what was the algorithm behind this you constructed to solve ?

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

        Suppose you have a 10 digits binary numbers — let 'xxxxxxxxxx' be his digits : what happen to those after the N operations? Can we get the same result with just 1x of each binary operation? :)

  • »
    »
    6 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +4 Проголосовать: не нравится
    a = 1023
    b = 0
    
    for each (op, val) in input:
        a = a op val
        b = b op val
    

    From there, we can see that for each bit in a and b:

    bit on / off: no operation;
    bit on / on: or operation;
    bit off / on: xor operation;
    bit off / off: or and xor operation.
    
»
6 лет назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

Those rooms in which there are no hacks are going to be destroyed by system tests. n = 10, k = 4, arr = {1 5 4 3 2 10 9 8 7 6} ans: 5

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

Hacked 3 solutions in the last 3 minutes... (my last hack was 3 seconds before the end) So tense!

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

Как решать С Див. 2?

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

    1) Нужно обратить внимание на следующее: Пусть изначальное число равно х, а первое действие — & a. Тогда если i-ый бит числа а равен 0, то i-ый бит результата тоже будет равен 0 вне зависимости от х. Аналогично если действие — | a, тогда если i-ый бит числа а равен 1, то i-ый бит результата тоже будет равен 1. Если действие — ^ a, то если i-ый бит числа a равен 1, то i-ый бит результата изменится на противоположное значение, иначе останется.

    2) Таким образом для конечного числа мы можем узнать для каждого бита будет ли он равен 1, либо равен 0, либо противоположен изначальному соответствующему биту, либо не изменится вовсе.

    3) Теперь составим числа ans1, ans2, ans3 следующим образом:

    ans1: в двоичном представлении нулю равны те биты, в которых в конечном числе они равны нулю, в остальных — 1.

    ans2: в двоичном представлении единичке равны те биты, в которых в конечном числе они равны единичке, в остальных — 0

    ans3: в двоичном представлении единичке равны те биты, в которых в конечном числе они должны поменяться на противоположное значение, в остальных — 0.

    Ответом будет:

    3

    & ans1

    | ans2

    ^ ans3

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

      Спасибо, но возник вопрос: под конечным значением в ans1, ans2, ans3 подразумевается конечное значение для какого числа?

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

        Конечное число — это число, которое мы получим после применения всех n операций

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

      Огромное спасибо!

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

I think for div 2 C the key is strongly connected components.

If you look at the directed graph of the strongly connected components it is always a straight line.

For each strongly connected component we need to save only two arrays of size K (the one with the minimum power levels for each skill and the one with the maximum power levels).

Thus we can save the strongly connected components inside a map (the key for the map is a structure containing the two arrays and the size of the component).

In order to add a new vertex we need to use a lower_bound on the map and then iterate through the map mixing together the new connected components.

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

    Div 2 C?? Are you kidding me??

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

    How did you bring connected components into picture Jefe ??

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

      we add an edge from vertex a to vertex b if player a can beat player b in at least one game. Then the players that have a chance to win the game are the ones that can reach every node. Of course these nodes form a strongly connected component.

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

        Okkay Got it !! Thanks

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

          Answer is number of strongly connected component or what ???

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

            Answer is the size of the initial connected component (they form a directed path)

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

              n is 5×10^4 though. Won't it get TLE?

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

                Jefe Sorry to disturb !!!! How would you solve for this one n = 3 k = 2 1 2 2 1 3 3

                so In the first case, a single node is present ,then the second node comes and two directed edges are formed 1->2 and 2->1 . How do you get answer here ??

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

                  First the first node forms a SCC -> answer = 1.

                  After adding the second node, you have a SCC nodes 1 and 2 -> answer = 2.

                  The third node will form a SCC by itself, and this SCC is better than the previous SCC (they form a directed chain SCC{3} > SCC{1, 2}). The answer will be the size of the best SCC -> 1.

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

                  Thanks I got it . :)

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

    I like the idea of that key structure.

    You find a position of the first characteristic and then move up and down looking for min/max on the next ones (expanding the interval), correct?

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

And again I will fail C :( When do I will come in div1 :(

OMG It passed :p. Finally here I come div1 :D

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

Huh, these were really hard B and C. How to properly solve B? I did something like binary exponentation of reductions (sequences when consecutive groups of same people are merged and when I see interval of length k of same numbers I throw it away). However when done naively these reducted sequences can grow a lot, so I kept only a big suffix and prefix of them, but I am not sure about correctness of the way I did it. On the beginning I tried to reduct initial sequence, then reduct result concatenated two times and consider some cases, but that seemed to be really prone to bugs.

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

    I hope I haven't missed any edge cases, but basically what I did was:

    1. Preprocess the single bus to remove as many teams as possible
    2. Process all the buses together, removing teams that came from the two consecutive buses
    3. At this point, if the "middle" buses (other than first and last) have contestants from more than one city, we're done. Otherwise, we take the prefix from the first bus, the number of participants from the middle buses, suffix from the last bus and do stuff in the naive way.
  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится -26 Проголосовать: не нравится

    Just curious.
    Is it easy for you to get the idea from source code 31746290?

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

This is not a Div.1, it is Div.0... I spent a lot of time to solve 1B. Anyway, I need to go to sleep...

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

Noooo.. I screwed up on div2C! I submitted 30 sec before end of contest and got WA because i thought that x was <= 2047 and not 1023 :(

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

How to solve Div2 E or Div1 C ???

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

How to solve div 2c ?

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится
    a = 1023
    b = 0
    
    for each (op, val) in input:
        a = a op val
        b = b op val
    

    From there, we can see that for each bit in a and b:

    bit on / off: no operation;
    bit on / on: or operation;
    bit off / on: xor operation;
    bit off / off: or and xor operation.
    
    • »
      »
      »
      6 лет назад, # ^ |
        Проголосовать: нравится +11 Проголосовать: не нравится

      same method as mine but in the bit off / off case , I used & operation instead of using | and ^ ..

      Any particular reason why you used | and ^ instead of just using & ?

      Anyways, here's my solution if you are interested.

      Short explanation : observe that 0 to 1023 means all numbers having 10 bits.. Also observe that all the & , | and ^ operations actually apply to INDIVIDUAL BITS rather than the full number... So keeping a = 1023 and b = 0 means all bits of 'a' are set to 1 and all bits of 0 are set to 0.

      so accordingly check what happens to them AFTER applying all the 'n' operations, If no change ==> means the AND bit was '1' , or bit was '0' and xor bit was '0' and so on..,

      my submission --> 31767545

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

        i don't understand. please explain more. why 1023 and 0, what i can get from them after the n operations.

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

          see, 1023 == (1 1 1 1..... 1) (10 times) and 0 == (0 0 0 ...........0) (10 times)

          so basically we can treat 1023 and 0 as rather a SET of 10 bits..

          now apply all the mentioned operations,

          after applying if the a particular bit of 1023 remains 1 and that bit of 0 remains 0, this means that all those operations do NOT CHANGE THAT PARTICULAR BIT IN ANY NUMBER! Why? --> well that's because in every number that particular bit can be either 0 or 1 and no matter what that bit is , it wont change because we have tested it for both 1 and 0

          Similarly there are 3 more cases , all the cases have the same reasoning , i.e. if 1 1023 bit changes but 0's bits do not change it means that whatever be the number that Bit has to be equal to zero,

          apply same reasoning to get to the final answer!.. Hope this helps!

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

            Thankyou.W hen i read your previous comment my mind was not registering the fact that BITS OPERATION apply to single bit, so i didnt understood the solution. so one day when i was working on something, suddenly my mind clicked and i was able to solve it. This was good problem.

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

How to solve Div2 D?

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

Здравствуйте , почему в 33 тесте в задаче B div2 ответ 4?

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

    Сначала играют игрок с силой 1 и игрок с силой 4, так как 4 > 1 то игрок силой 4 побеждает в партии и получает первую победу, игрок с силой 1 уходит в конец очереди. Далее играют 4 и 3, 4 > 3 так что игрок с силой 4 получает вторую победу подряд и становится победителем.

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

Is the Div.1 contest really of the difficulty of Div.1? I spent more than 1h 40min working on B and only resulted in 5 Wrong Answers on pretest.

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

O(NQ) solution for problem D .

Ugly code, without any beautiful optimizations, but ... AC =)

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

Thank you for Great 5 problems!

btw, After contest I accepted E by add one character on my TLE code (And I knew that could cause TLE, but my unconsciousness omitted that character). and I passed only A :(

I really liked this problemset although I'll get -170 :) I hope future codeforces round keep this quality.

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

Thank you for 5 great problems!

btw, I got AC on E after contest by adding one character on my TLE code (I knew that could cause TLE, but my unconciousness omitted one character). and I got only A passed :(

I really liked this problemset although I'll get -170 :)

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

Tests for div1B are weak. Noam527 found a test, that breaks my AC solution:

4 3 3

1 1 2 1

http://codeforces.com/contest/878/submission/31762139

My solution outputs 6, while it should be 0.

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

    It is very bad to provide a hard task with weak tests:

    1. Not many people will solve it and they would be upset that other guys have accepted incorrect solutions.
    2. Those, who solved it correctly, would be upset that some other folks have accepted incorrect solutions, lowering their achievement.
    3. Those who have accepted incorrect solutions would also be upset, as this gives them no satisfaction and unjustified points. (Not 100% sure about that though.)
»
6 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

 Долго же я думал, где память подводит...

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

Challenge: div1D with k ≤ 1000.

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

    Do you have a solution on mind or is it just your wishful thinking? Looks really hard

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

      I think that my solution will work (except for input and sorting (the latter can be done in linear time))

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

        Can you please explain your solution? I could not understand the code.

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

          Let's suppose we have only one query of third type. Then we can maintain only the characteristic which we are asked for. Now let's do binary search on answer (there are only k possible answers), then we can maintain only one binary characteristic: is the real characteristic bigger than our bound (from binary search). Max/min on binary characteristic is equivalent to or/and.
          Now we can do parallel binary search for all queries of the third type and do our operations using bitsets.
          Complexity will be

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

Well,good problems today.

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

can anyone please explain Div 2 problem C logic ? thanks in advance :)

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

I failed test case #7 on problem C div 2.

Can somebody tell me what is wrong with my result?

3
^ 125
^ 377
& 1019

Participant's output

2
& 1019
^ 260

Jury's answer

2
| 4
^ 260

Checker comment wrong answer The participant's program isn't equivalent to the input

I passed this one with the same idea, grouping by operators:

3
& 242
^ 506
^ 522

Output

2
& 242
^ 1008

Answer

2
| 781
^ 253

Checker Log ok Ok

Thanks in advance!

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

    Just try any input, e.g. 0. With the input program: ((0 ^ 125) ^ 377) & 1019 = (125 ^ 377) & 1019 = 260 & 1019 = 256. With your program: (0 & 1019) ^ 260 = 0 ^ 260 = 260.

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

Cheater Report:- ImNaman and kingside have cheated as you can see even variable names are same for problem A and B and slight change in variables of C.

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

When will be editorial published?

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

khadaev, а подскажите, пожалуйста, какой 23й тест в B(div1). по префиксу непонятно :(

UPD: неактуально, подсказали другой тест, который пофиксил эту проблему

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

Во время контеста вынужден был пересесть за другую машину; на этот момент первые две задачи были решены. Далее решал div2C на ideone, все отлично, дождался результатов и, о боги, 163 место! (к слову, я никогда так высоко не подымался).
Вечером жду обновления рейтинга и выясняю, что все мои попытки проигнорированы. Погуглил и выяснил, что ideone нельзя использовать. Но, во-первых, я поверх div2C начал решать следующую; во-вторых, почему проигнорированы первые две задачи? Кто-то действительно успел залить мое решение, или участник приравнивается к читеру из-за факта наличия кода в ideone? обидно :(
ideone: https://ideone.com/nPt1N8;
мое решение div2C: http://codeforces.com/contest/879/submission/31756708

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

Editorial!!?

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

Will there be any editorial? Thx :)

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

Why are the editorials so late?

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

Can Anyone Explain Div 2 Problem A?

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

    Iterate through the array of s[i] and d[i] and keep updating the present day of meeting the current doctor.

    To update the present day, if (presentDay < s[i]) presentDay = s[i]

    Otherwise, find the smallest value of k (>=0) such that: presentDay < s[i] + k*d[i] and put presentDay = s[i] + k*d[i] for that value of k

    The answer will be the presentDay for the last doctor in the array

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

Where is the editorial??

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

Hello, can someone tell me where can I find the editorial of this contest? Thanks.

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

In proB, why test 5 2 1 4 2 5 3. The output is 4? I think the output is 5? Can someone explain for me?

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

    5 2
    1 4 2 5 3
    first win: 4 because (1 < 4).
    4 2 5 3 1
    the second win: 4 because (4 > 2).
    Answer 4 (because 4 won two wins in a row).

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

      5 2 2 1 3 4 5 this test why the power's winner is 5 ? I think answer is 3 ?

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

        5 2
        2 1 3 4 5

        2 1 3 4 5 winner is 2
        2 3 4 5 1 winner is 3
        3 4 5 1 2 winner is 4
        4 5 1 2 3 winner is 5
        5 1 2 3 4 winner is 5
        5 have two wins. It means answer is 5.

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

Where is Editorial?

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

I get WA in Div2 C because of additional space at the end of first line. I thought that Codeforces typically ignores additional spaces at the end of line.