FRB_MESSI_3MK's blog

By FRB_MESSI_3MK, history, 3 months ago, In English

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 ?

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

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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));
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    it does overflow i did get a wrong answer before trying long long