SlepoiKrot

Untitled

Mar 2nd, 2018
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Project2;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6. SysUtils;
  7.  
  8. var
  9. n, m, k, i, x1, y1, x2, y2, x3, y3: integer;
  10. begin
  11. readln (n, m);
  12. readln (k);
  13. for i := 1 to k do begin
  14. readln (x1, y1, x2, y2, x3, y3);
  15. if ((x1 = x2) and (y1 = y2) or (x1 = x3) and (y1 = y3)) and ((x1 <> m) and (y1 <> n) and (x1 <> 1) and (y1 <> 1)) then begin
  16. writeln ('NO');
  17. end
  18. else if ((x1 = x2) and (y1 = y2) or (x1 = x3) and (y1 = y3)) and ((x1 = m) or (y1 = n) or (x1 = 1) or (y1 = 1)) then begin
  19. writeln ('YES');
  20. end
  21. else if (abs (x1 - x2) = abs (y1 - y2)) and (abs(x1 - x3) = abs(y1 - y3)) and ((x1 >= x2) and (y1 >= y2) and (y3 >= y1) and (x3 >= x1) or (x2 >= x1) and (y2 >= y1) and (x3 <= x1) and (y3 <= y1))then
  22. writeln ('NO')
  23. else
  24. writeln ('YES');
  25. end;
  26. readln;
  27. readln;
  28. end.
RAW Paste Data