[HELP] Need help on its memory limit

Revision en2, by simp_pro, 2024-01-01 12:04:04

Submission link: https://codeforces.net/contest/1292/submission/239863555

adj is going to use n long long int

dp, cnt, par : n^2 * 3

Each pair of vertices has unique distance so prs would also hold n*n long long int

Total = 4*n^2 = 4*(3*10^3)^2 = 36*10^6 long long int

1 long long int uses 8 Bytes so total = 36*10^6*8 Bytes = 288 * 10^6 Bytes = 288 Megabytes. Memory limit is 512 MB but still I am getting MLE.

Where am I wrong?

Tags help, mle

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English simp_pro 2024-01-01 12:04:04 2 Tiny change: 'tance so pairs would a' -> 'tance so prs would a'
en1 English simp_pro 2024-01-01 12:01:56 485 Initial revision (published)