Comparing the given problem and time complexity of my solution, why is the time taken so high

Правка en2, от zzzzsust19, 2022-09-16 12:51:44

Problem link: https://codeforces.com/problemset/problem/1294/D

My submission: https://codeforces.com/contest/1294/submission/172332862

The problem I am trying to solve has constraints as given, 1 <= q, x <= 4 * 10^5 The time complexity of the solution I have submitted is around O(2 * q). It's basically a linear time solution.

My expectation was that the highest time it would take would be around 100-200 ms. But the solution took around 1200 ms at worst case. Which is far higher than I expected. What is the reason behind this high time complexity

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский zzzzsust19 2022-09-16 12:51:44 4
en1 Английский zzzzsust19 2022-09-16 12:51:01 652 Initial revision (published)