[HELP] Need help on its memory limit

Правка en2, от simp_pro, 2024-01-01 12:04:04

Submission link: https://codeforces.me/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?

Теги help, mle

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский simp_pro 2024-01-01 12:04:04 2 Tiny change: 'tance so pairs would a' -> 'tance so prs would a'
en1 Английский simp_pro 2024-01-01 12:01:56 485 Initial revision (published)