Time Complexity Variation

Revision en1, by xINFERNOx, 2021-12-17 22:40:08

Why the second code executes within 500ms whereas the first one gives TLE(2000ms) ?

1497E1 - Square-Free Division (easy version)

const int N = 1e7 + 5;
vector<int> maping(N);
int i,j;
Code 1
Code 2
Tags number theory, sieve of eratosthenes, #sieve, doubt

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English xINFERNOx 2021-12-17 22:40:08 709 Initial revision (published)