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

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

I was trying to solve IZHO14_bank on oj.uz. In problem $$$n, m <= 20$$$ and Time Limit is 1s.

Time complexity of my solution is $$$O(2^m \cdot m \cdot n)$$$. It's $$$TLE$$$ because $$$2^{20} \cdot 20 \cdot 20 = 419 430 400 > 10^8$$$.

My both code have same time complexity but my $$$1^{st}$$$ code is $$$TLE$$$, $$$2^{nd}$$$ got $$$100$$$ score.

Can someone explain why my $$$2^{nd}$$$ code isn't $$$TLE$$$ $$$?$$$
$$$1^{st}$$$ submission https://oj.uz/submission/854216 gives $$$TLE$$$,
$$$2^{nd}$$$ submission https://oj.uz/submission/854864 got $$$100$$$ score.

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

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

2 operations on 2 closer elements make your code faster.

if you wanna know more