Haskell in SPOJ: "Wrong answer" in the problem, but correct on my computer

Today I introduced SPOJ solutions in Problem with COINS . I got Fortran and Perl solutions, but I got a "Wrong answer" in a Haskell solution. I thought that maybe my code was incorrect at some point, but the results for 200K numbers (100K in the upper limit and 100K in the lower) exactly correspond to the Perl solution, as shown below:

angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ seq 1000000000 -1 999900001 > p346.in
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ seq 0 100000 >> p346.in
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ ./p346.pl < p346.in > p346.po
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ ghc --make -o p346.exe p346.hs
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ ./p346.exe < p346.in > p346.ho
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ diff p346.ho p346.po
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$ head -n 5 p346.ho
4243218150
4243218150
4243218150
4243218150
4243218150
angelv@vaso:~/Dropbox/ProgrammingGym/SPOJ$

Is there any way to find out what might happen (maybe the last few lines of the generated output?).

+3
source share
1 answer

, SPOJ. , , SPOJ : ", !", , , . ( , .. ( Haskell), SPOJ , ?)

Haskell, , Haskell, , " " .

, , , (. SPOJ frecuently, , , , , " , ".)

, , , , .

: IRC Haskell, "System.Exit". , , : http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/System-Exit.html

, "" SPOJ, , . ? Haskell IRC Haskell , - .

+1

Source: https://habr.com/ru/post/1757306/


All Articles