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

Автор wck_iipi, история, 5 часов назад, По-английски

I was doing the following question: https://codeforces.me/contest/2044/problem/F

Upon doing this question, I used a method that gives the solution in O(nq) time (about 2 * 10^5 * 5 * 10^4 = 10^10 operations). Code is as follows:

https://codeforces.me/contest/2044/submission/304178376

Spoiler

However, the official solution is in O(n^2) time, which is about (4 * 10^10 operations). https://codeforces.me/blog/entry/137306

Spoiler

My solution, however gives TLE. Why is my solution giving TLE but official is not even though operations are lower?

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

»
5 часов назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится
FOR(i, 1, N) {
    FOR(j, 1, N) {
        if(i * j > N) break;

It is $$$O(n \log n)$$$

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you I missed that.