solution for Timid Person — Jollybeeoj

Правка en2, от bluemmb, 2015-12-28 20:00:54

Hi , obviously this problem can be solved in O(N*M) with help of an array for counting, because numbers are <=1000 . but what is the best algorithm for solving this problem when numbers are <=1e9 ?

I wrote this code that works in O( N*M*log(N*M) ) but it got TimeLimit ( in 1second ) . How can we reduce this complexity ?

UPD : sorry , I linked to wrong source code. fixed.

Теги timid person, jollybeeoj

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский bluemmb 2015-12-28 20:00:54 69
en1 Английский bluemmb 2015-12-28 12:16:38 433 Initial revision (published)