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

Автор ch_egor, 3 года назад, По-русски

Всем привет!

В этот вторник пройдет московская олимпиада школьников по программированию для 6-9 классов. Над туром работала Московская методическая комиссия, известная вам также по Открытой олимпиаде школьников по программированию, Московской командной олимпиаде и олимпиаде Мегаполисов (раунды 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541, 545, 567, 583, 594, 622, 626, 657, 680).

Раунд состоится 23.02.2021 12:05 (Московское время). Вам будет предложено 5 задач и 2 часа на их решение. Раунд будет рейтинговым для второго дивизиона (рейтинг ниже 2100). Как обычно, участники из первого дивизиона могут написать контест вне конкурса.

Задачи соревнования подготовлены grphil, Jatana, rip, Sehnsucht, DebNatkh, KiKoS, wrg0ababd, V--o_o--V, voidmax, meshanya, vintage_Vlad_Makeev под моим руководством.

За координацию раунда спасибо adedalic, за перевод условий cdkrot и meshanya, а так же MikeMirzayanov за системы Codeforces и Polygon, который использовался при подготовке задач этой олимпиады.

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

Всем удачи!

Заранее сообщаем, что из-за проведения официального соревнования исходные коды других участников будут недоступны ещё час после окончания раунда.

UPD1: Спасибо LHiC, awoo, ScarletS, adarsh7777, kassutta, raj_mehta_ за тестирование.

UPD2:

Разбалловка: 500 — 1000 — 1500 — 2250 — 3000

UPD3: Разбор

UPD4: Победители!

Div. 2:

  1. InternetPerson10
  2. egor95123657
  3. hhhyyyfff
  4. xXx_KevinDu58_xXx
  5. Flying2021

Div. 1 + Div. 2:

  1. Um_nik
  2. qazswedx2
  3. 3.141592653
  4. BigBag
  5. InternetPerson10
  • Проголосовать: нравится
  • +62
  • Проголосовать: не нравится

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

thanks for this round.

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

The competition announcement should include a link to the competition: Codeforces Round 704 (Div. 2)

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

I am curious: why do all these contests prepared by Moscow Olympiad Committee have unusual timing?

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

Will the problem score distribution be announced for this round (since there is an official competition as well)?

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

I believe it will be a wonderful round!

Hope all of us can get good scores!

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

Notice the Unsual Timing.

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

For me living in China ,the timing is so good.

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

As a Chinese coder, I'm surprised to find out it's a good time for me to participate in the contest, normally for join the contest in Codeforces, I have to stay up late.

I'm looking forward to solving the problems, it'll be another chance for me to challange and improve myself. Stay Cheeki Breeki!

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

Please can the timings be changed because students of many countries won't be able to take part due to their college lectures ?

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

ok sorry for that.

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

Note: Unusual time

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

Unusual timing = less competition

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

One of my friends is interested in setting up a round. Does anyone know typically how much time it takes for the entire process (proposal of the round to the hosting of round)?

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

Hoping to get scoring distribution as early as possible

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

You guys(Russian school kids) do train hard regularly.. Nice going .. Hope to see similar things in my country too.

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

I sense chaos

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

I am curious: why do all these contests prepared by Moscow Olympiad Committee have unusual timing?

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

Even though we have quit our music career, we will continue to give contests on Codeforces.

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

Please share score distribution too

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

It hurts...

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

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

hope green delta for all

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

This timing is so much better for me. Afternoons are usually slow, this can give a nice touch. All the best to all.

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

I hope my rank and rating will be increase in this contest :)

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

I missed the time :(

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

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

Is C DP or greedy?

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

    answer is just lastoccurence[t[i+1]]-firstoccurence[t[i]] . but find occurence as if you take this s[i] there is one beautiful sequence. see my code for find first and last occurence :(

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

      except lastoccurence[t[i+1]] depends on the lastoccurence[t[i+2]] so you need to technically check the last occurence that does end up in a valid subsequence

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

      it is not, consider testcase

      5 3
      aaaaa
      aaa
      

      ans==3, but your simple formular gives 4

      A more correct solution find the leftmost possible subeq of t[] in s[], and the rightmost one. Then ans is the max of the diff in all positions in left and right.

      Edit: Changed to reflect that ans==3, not 2.

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

        hey, can u please elaborate on how the answer is 2?

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

          We can choose the indexes of the subseq as 1,4,5, then ans==3.

          You are right, it is not 2. But the point is that it is also not 4.

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

      it's $$$max(postfix[m-i]-prefix[i])$$$ where $$$postfix[i]=$$$ largest index $$$j$$$ s.t. $$$s[j..n]$$$ contains $$$t[i..n]$$$ as a subsequence. and $$$prefix[i]= $$$least index $$$j$$$ s.t. $$$s[1..j]$$$ contains $$$t[1,,i]$$$ as a subsequence.

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

How to solve D ? :(

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

    I think maximum $$$k$$$ is obtained for something like $$$a = 11111000$$$, $$$b = 10111001$$$. I may be wrong. But this seems to work. We can then shift bits in $$$b$$$ to get all smaller values.

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

    we can get k ones if we subtract 2^0 from 2^k.

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

    first observe it, 1 -> 1 and 0 -> 0 results in 0, only you can use 0 -> 1 or 1 ->0 to have one.

    secondly, if you form a pattern like this -> 111000 011001 from this pattern you can have (one + zero -1) number of 1 as k. Now think a bit more about it. Hope you'll find the answer.

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

      if you can't still find the answer then think of it,

      10
      01
      

      if you put same bit inside those like this,

      111000
      011001
      

      then all of them will contribute in the answer except the first one. Now try rest by yourself.

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

How to solve E?

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

What was famous hack in problem D?

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

Can Anyone tell me pretest 18 of the D of this contest

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

Hacks,hacks everywhere!!!

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

Can anyone explain why my code for E is wrong on pretest 27?

108288547

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

Almost missed this round. UNUSUAL TIMING (: Started 5 minutes late with the fastest heartbeat ever.

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

Can anyone help. Why this solution is wrong import java.util.*;

public class A {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    int testCases = sc.nextInt();

    for (int t = 0; t < testCases; t++) {
        double p = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();

        long ans = Long.MAX_VALUE;

        long temp = (long) Math.ceil(p / a);

        ans = Math.min(ans, (long) (temp * a - p));

        temp = (long) Math.ceil(p / b);

        ans = Math.min(ans, (long) (temp * b - p));

        temp = (long) Math.ceil(p / c);

        ans = Math.min(ans, (long) (temp * c - p));

        sb.append(ans).append("\n");

    }

    System.out.print(sb);
}

}

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

    Calculating with large values and floating-point numbers gets imprecise, so for example the ceil might not give the correct value. Example

    Use integer ceil instead:

    ceil(a / (double)b) =
    (a - 1) / b + 1
    
»
3 года назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

I tried to hack A with 99999999999999998 2 2 2 but got an invalid hack error

Validator 'validator.exe' returns exit code 3 [FAIL Expected int32, but "99999999999999998" found (stdin, line 1)]

even though, the problem clearly says p < 1e18

Someone from the authors, please clarify this?

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

Can anyone explain why my submission for E 108288547 have WA on pretest 27?

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

how to do B i'm getting tle

edit: can we do it using bitset i've got the logic but not able to implement if someone has done it using bits please do share ur code

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

How sad it is when I got the observation for D so early but kept getting WA at pretest 8 around 1 hour and half :((

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

    The most important observation in D is that there is a good chance of bad edgecases.

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

      How do you know about the contest, sir, you didn't participate.

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

        I did, but did not submit anything. I was horrible slow in A and decided to try B first. That went not much better, so I solved C. Then after D I again thought about submitting the solutions...but I think I could missed some edgecases in D and the big time panalty from ABC... so in the end nothing was submitted.

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

    Try this

    1 4 3
    Yes
    11110
    10111
    
  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    try this:

    1 1 1

    ans: No

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

just now: hackforce

soon: FSTforce

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

Why is everyone discussing solutions and hacks... The contest for the kids is still going on in Russia.. Let's just control our curiosity for an hour

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

Due to the official competition source codes of other participants will not be available for an hour after the end of the round.

So maybe we shouldn't discuss anything about the contest especially the solutions and the hacks.

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

Felt more of like a Div 2.5 contest. It was great !!!

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

Thanks for the "strong" pretest of problem D!

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

In C .. why does the logic of setting max,min for each index (keeping in mind the neighbouring char's max,min index) fails on pretest 5. You can check my submission : https://codeforces.com/submissions/indresh_0903 Can anyone please help :/

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

    Submission viewing is off for an hour ,as official contest is still going on

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

    Notice the condition : $$$1≤p_1<p_2<…<p_m≤n$$$ .

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

      Yeah it was taken into consideration while calculating possible max and min index for each t[i] .. for each index .. its max is < max of i+1 (with base condition of t[m-1] )and its min > min i-1 (with base condition of t[0]) if for a particular 'i' its min and i+1's max will give me the ans, then for all index >i+1 .. there max-es will be used

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

        max and min doesn't guarantee the right sequence.

        for example,

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

          im getting 1 as answer for this tc i guess its correct

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

            It might work out for you. But, there would be some testcase where you calculated the difference of two illegal indices (i.e. these indices might not form a beautiful sequence) and set it as max.

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

              Dude i have set max of index i strictly smaller than max of i+1 and min of index i strictly greater than min of i-1 .. so i dont think that would be an issue

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

So scary (be hacked in last 10 mins) and so rubbish pretest in D! ):

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
from math import ceil
 
t=int(input())
for _ in range(t):
    p,a,b,c=map(int,input().split())
    print(min(ceil(p/a)*a-p,ceil(p/b)*b-p,ceil(p/c)*c-p))

Why is this wrong for A?

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

Guys did anyone else have this problem? When I sent a solution it said that I had already sent that solution but I was sending it first time. I did anything possible but it always said that I had already sent that solution.

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

Was D having a simple idea to trigger 1s in result starting from a pattern like

1 1 1 0 0 0

0 1 1 0 0 1.

Triggering flood of ones from right at 0,1 pair and stopping at 1,0 pair.

I didn't participated but just pondering over the idea.

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

    That is.

    Also, you can only produce 1s in that way since you have to use the same amount of 0s and 1s in x and y.

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

    well i too thought of this idea first , then i came to know that leading zeroes are not allowed in string x and y

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

This gives me RE on pretest 5

RE

whereas this gets AC on pretest

AC

I have changed only this much part of the code and nothing else. Someone please help me out in debugging the error.

UPD: I got the mistake I was doing. Thank you all.

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

@Admin/@MikeMirzaynov, if a person participates in a contest, why is it that that person is not allowed to make another submission until the system testing concludes? (Obviously I'm not asking you to count submissions after contest gets over) It has happened very often that I don't get a problem within the contest time bounds but do have a solution immediately after the contest gets over — and I have to wait for a while before my submission can be evaluated (because system testing is running) — Its bad enough that I wasn't able to solve it within the bounds, worse still that I can't check if my code is right or not when I finish it. Request you to look into it if possible...

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

    The answer is pretty obvious if you think, they want all their server power to be focussed upon system testing, so that they can be finished as fast as possible with the limited server power that they have.. The eagerness to know our solution's verdict has to be sacrificed a bit for this.. Tough world xD

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

      But anyone can still submit concluded contest problems — server gets used for that also no? I think your logic breaks because of that...

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

Why was there sudden change in timings ? My midsems are approaching and had to miss 2 classes, nevermind tho, the contest was worth it. Sincere request to not change timings, old timings were perfect.

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

How to solve C using dp?

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

Is there any solution for E using graphs??

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

Thanks for the round though the pretests are a bit too weak...

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

good contest

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

Is this round "FSTForces" ?

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

Fst forces

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

Poor pretest for D :(

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

codefst

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

codefst

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

Believe it or not, I believe that today's round is just for hackers...(At least D)

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

Some very weak pretests for D (:

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

I want to know who makes problem D's data?

At least 400 coders failed system tests on this problem :)

(include me).

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

Thanks for the strong pretests! Love pretest producer!

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

Is this submission for A hackable? He used ceil and float when numbers are as big as 1e18. I got cases which fail in g++14 and couldn't find a hack case since he submitted in g++17

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

qwq oh noooooooooooo!thanks for pretest!!!

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

Good Guy! case for a=0 not in the pretest. Fst so many people.

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

Nobody:
Codeforces even after the systest: You're contestant.

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

Why I am not able to submit my code after system testing is over?

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

This Round is quite hard for me. QwQ

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

WHAT GOOD PRETESTS!!!!!!!! :(

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

Love this pretest. Expert time uwu

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

Corner cases should be included to the pretests...!!!

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

Maybe the pretests of D are too weak...

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

Maybe you should enhance the pretests carefully next time, otherwise people like me would be so sad to see their ratings fall...

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

I think the pretests of Problem D are too WEAK, many possible datas are IGNORED.

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

We're still unable to make any submissions post-contest. I believe, usually, we're allowed to submit immediately following the completion of system testing. Is there a reason that we still can't make submissions? I imagine there's a few people waiting to make corrected submissions following the large number of system test fails.

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

May be there should be some rule like if 30% pretest passed submissions failed main tests, round becomes unrated.

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

    Nah, official solutions are often tested very carefully to ensure that there is nothing wrong with them, especially when a problem is prepared for a major city-wide contest. If your solution fails system tests, it's safe to assume that it is wrong. Of course it can be the case that the official solution is wrong, but this has rarely happened in the past.

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

thanks for this round.

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

To not keep you waiting, the ratings updated preliminarily. In a few hours, I will remove cheaters and update the ratings again!

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

Thanks for this round.

But the pretests are a bit weak, and the problems are a bit easier than other Div.2? And I think five problems aren't enough for two hours. There are too many people solved out all the problems (even in the first hour) but failed on the system tests.

Hope there will be a better contest.

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

    I think one should more focus on checking correctness of his/her code rather than submitting it fast.

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

Why can't I hack solutions anymore? The button is gone although it didn't pass 7 days.

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

ll n, m; cin >> n >> m; string a, b; cin >> a >> b; vians; ll mx = -1e9; f(i, 0, m — 1) { char p = b[i]; char q = b[i + 1]; ll pos1 = a.find(b[i]); ll pos2 = a.find_last_of(b[i + 1]); ans.pb((pos2 — (pos1))); amax(mx, ans[i]); } // if (ans.size() > 0) { // ll anss = *max_element(all(ans)); // print(anss); // } print(mx);

can anyone tell what i am missing here? like i am finding left occurance of i and right occourance of i+1,,and taking max of them.

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

I don't want to raise any negativity but submissions from LiM_256 and sawa855 are suspiciously similar. They can be found at number 614 and 617 in final "official" standings. Seems like, they tried to alter some code to get away. Obviously, I'm not mentioning them.

Spoiler

PS: I apologize if I bring out something incorrect.

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

Hi, In problem A my solution was giving wa but I am not able to find reason for that. after that i changed my code, it got accepted. I am providing links of both , if anyone knows about this do reply. Accepted Wrong Answer

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

    I am not sure but when i used both of your code for test case : 1 1000000000000000000 3 3 3 The "Accepted" one is giving -64 and "Wrong Answer" one 0 as answer, i think its most probably because of overflow or something like that, the correct answer should be 2 for this test case.

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

    I think it's because ceil does not return an integer, which leads to floating precision issues. As mentioned many times above, try not to rely on ceil.