tamthegod's blog

By tamthegod, history, 3 years ago, In English

It seems that Judge Protocol work in ongoing contest. It this a bug ?

Full text and comments »

  • Vote: I like it
  • +66
  • Vote: I do not like it

By tamthegod, history, 3 years ago, In English

I passed the pretest but got fst with the pretest again 148588961 and got ac with the exactly that code in practice mode 148606321. Those codes are exactly same. Please, MikeMirzayanov can you rejudge the submission. Thanks.

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it

By tamthegod, history, 3 years ago, In English

Today in contest cf round 749, I have FST in problem C (WA on test 16 in C++20) 132242048. After contest I have no change in my code and I submit in C++17 (WA on test 19) 132266690 and in C++14 and got accepted 132266932. What is the magic here ! Pls explain to me ! Thanks.

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

By tamthegod, history, 3 years ago, In English
ll res = -oo;
    for(int k=1; k<=n; k++)
        for(int i=1; i<=n-k+1; i++)
            for(int j=1; j<=n-k+1; j++)
            {
                f[i][j][k] = f[i][j][k - 1] + a[i + k - 1] * b[j + k - 1];
                res = max(res, f[i][j][k]);
            }
    cout << res;
ll res = -oo;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
            for(int k=1; k<=n; k++)
            {
                if(k + i > n || k + j > n) break;
                f[i][j][k] = f[i][j][k - 1] + a[i + k - 1] * b[j + k - 1];
                res = max(res, f[i][j][k]);
            }
    cout << res;

These code seem not to be differ too much but execution time have much differ. Example in case n = 500, code1 run in 3103ms but code 2 run only 789ms. What is the reason ? Pls explain to me. Thanks.

Full text and comments »

  • Vote: I like it
  • +20
  • Vote: I do not like it

By tamthegod, history, 4 years ago, In English

105860386 If I'm not mistaken the complexity of this code is O(n) with 1 <= n <= 10^9 . Please explain to me !!. Thank you.

Full text and comments »

  • Vote: I like it
  • +22
  • Vote: I do not like it