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

Автор Siyah, история, 7 месяцев назад, По-английски

It is sad that

marzipan tried to convince others to write the blog goodbye 23 to get contribution.

but his blog got -3500 [so far]

Полный текст и комментарии »

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

Автор Siyah, история, 9 месяцев назад, По-английски

Hi, Is there a way to download my submitted file using the Codeforces API?

i use this but not working

PLEASE HELP

Полный текст и комментарии »

Теги api
  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

Автор Siyah, история, 9 месяцев назад, По-английски

hey I wanted to get the most upvoted post in CF but I got negative contrib.

so I decided to get the most down voted post on CF.

please help me :((

Полный текст и комментарии »

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

Автор Siyah, история, 10 месяцев назад, По-английски

OK — I GOT -20 , IGNORE THIS FUCK THIS LIFE

Hi ^~^

Part One [Useful Functiones]:

1.1 — power-Function:

[Binary Exponentiation] is a trick which allows to calculate $$$a^n$$$ using $$$O(\log n) $$$

The idea is that we can traverse through all the bits of a number from LSB to MSB in $$$O(\log n) $$$ time.

Write $$$n$$$ in base $$$2$$$.

The number has exactly $$$ \lfloor \log_2 n \rfloor + 1 $$$ digits in base 2, we only need to perform $$$O(\log n) $$$ multiplications, if we know the powers $$$a^1, a^2, a^4, a^8, \dots, a^{2^{\lfloor \log n \rfloor}}$$$ .

Implementation

1.2 — GCD-Function:

[Euclidean algorithm] is a trick which allows to calculate $$$gcd(a,b) $$$ using $$$O(\log \min(a, b))$$$ The idea is that subtract the smaller number from the larger one until one of the numbers is zero.

For Time Complexity and Binary GCD you can read This.

Implementation

Note that you can calculate $$$lcm(a,b)$$$ with $$$\frac{a}{gcd(a,b)}\ * b $$$

1.3 — Factorial & nCr & ...:

Sometimes you need to calculate $$$\binom n k $$$

For that first we precompute all factorials modulo $$$ mod $$$ with $$$O(N)$$$.

Implementation

BUT WE CAN PRECOMPUTE INVERSE OF FAC[I] IN $$$ O(Nlogmod) $$$

Implementation

1.4 Fibonacci in 20 line:

as you know you can calculate $$$n-th$$$ Fibonacci number with matrix.

here

it can be proved that :

F[2*n — 1] = F[n]*F[n] + F[n — 1]^2

F[2*n] = (F[n — 1] + F[n + 1])*F[n] = (2*F[n — 1] + F[n])*F[n]
Implementation

tnx kien_coi_1997 and I_love_tigersugar

1.5 Built-in useful function:

        vector<int> a(n);

        iota(a.begin(), a.end(), 1);
    // a = 123..

        random_shuffle(a.begin(), a.end());
    // a = random permutation of a

        vector<int> ps(n);
        partial_sum(a.begin(), a.end(), ps.begin());
    // ps[i] = a[0] + a[1] + .... a[i-1] + a[i] ( ps[i] = ps[i-1] + a[i])

        vector<int> h(n);
        adjacent_difference(a.begin(), a.end(), h.begin());
    // h[0] = a[0]
    // (i>0) h[i] =  = a[i] - a[i-1]

        cout << accumulate(a.begin(), a.end(), x) ;
    //cout x + a[0] + a[1] + a[2] + ... + a[n]

        cout << inner_product(a.begin(), a.end(), b.begin(), 234) << "\n";
    // x = 234 + sum(a[i] * b[i])

tnx Igorjan94 for this

Was this blog helpful?

Полный текст и комментарии »

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

Автор Siyah, история, 10 месяцев назад, По-английски

i was doing CP but In queue . . .

UPD : FIXED

Полный текст и комментарии »

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

Автор Siyah, история, 10 месяцев назад, По-английски

Hello ^^

I have seen many TODO editorials after 10-11 years.

Can it be completed?

for example: Blog 1 Blog 2

and so on

Полный текст и комментарии »

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

Автор Siyah, история, 10 месяцев назад, По-английски

Hi today this user used public computer and didn't log out of his account afterward, so we are writing this blog to educate people about importance of logging out :)

Полный текст и комментарии »

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

Автор Siyah, история, 11 месяцев назад, По-английски

Hi^^,

Can someone explain me the problem of SEERC2020 — Problem I? [I didn't understand the editorial]

And share the code if possible.

Link of problem : PROBLEM I

Полный текст и комментарии »

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

Автор Siyah, история, 11 месяцев назад, По-английски

Hi ,

I was looking at blogs with tricks tag when I came across something interesting.

on the page that is specified for each tag and shows the blogs of that topic; The preview for any blog is the message that is written — not the message that needs to be displayed — .

Look at the picture below to see what I mean.

Полный текст и комментарии »

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

Автор Siyah, история, 11 месяцев назад, По-английски

In your opinion, what is the most important factor for a good Contest? and can u share a some good contest?

Полный текст и комментарии »

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