ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1642. 1D Maze

WA 18
Posted by coolhackermasya 13 Mar 2017 23:06
var
b,a,i,c,n,d,an,k,x:integer;  // many variables from other programms...
dev:boolean;
s:string;
begin
read(k,n);
dev:=true;
b:=1001;
//didn't no about abs
if n<0 then x:=-1;
if n>0 then x:=1;
for i:=1 to k do
begin
read(a);
if (0<a*x) and (a*x<n*x) and dev then begin s:=('Impossible'); dev:=false end; // can't reach the end
if abs(a)<b then b:=abs(a);      //nearest obsacle to start point
end;
if dev then // output
begin
if n>0 then writeln(n,' ',n+b*2);
if n<0 then writeln(abs(n)+2*b,' ',abs(n));
end
else
writeln(s);
end.




**********Can't understand what's wrong************
Re: WA 18
Posted by Daniel Paleyev [SESC] 17 Oct 2017 19:14
input :
15 23
252 33 215 789 1000 123 -125 29 -45 -450 121 -555 -72 120 123
output :
23 113