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

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

Problem Name:

1879B - Chips on the Board

Hello codeforces i have this problem that i've solved time ago but going through my submissions today i've found it and this is my sollution 226472257 but with 109MS time and 4700KB memory

is there any way to optimize it ?

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

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

You can cut memory usage by 2

    vll a(n);
    for (auto& it : a)cin >> it;
    ll aa = accumulate(all(a), 0ll);
    ll ma = *min_element(all(a));
    for (auto& it : a)cin >> it;
    ll bb = accumulate(all(a), 0ll);
    ll mb = *min_element(all(a));
»
8 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Maybe changing some of the data type to be int if it doesn't cause overflow?