profesir's blog

By profesir, history, 4 years ago, In English

Can you please tell me more efficient approach to TIP1(spoj).

Here is my code causing TLE problem.

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Don't use long long for all variables (In this problem you don't need long long).

Change the way to check if PHI(N) is a permutation of N (using frequency array).

Pre-calculate all answers before testcases then for each test print the answer only.