My solution used or than 8 Mb memory! So I couldn't pass this task until memory limit was increased :)
I make a system of size about 1000x1000 ( exactly M+N-2 ) of double. Then I slove it and have all currents and potential. After I select currents that start from the 1st point and R = 1/I. How did you do this task using so less memory (<300Kb)?
P.S. What is the size of your source? Mine is 43 lines :)