codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

336A.md (1662B)


      1 Source: https://codeforces.com/problemset/problem/336/A
      2 
      3 A. Vasily the Bear and Triangle
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Vasily the bear has a favorite rectangle, it has one vertex at point (0, 0), and the opposite vertex at point (*x*, *y*). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes.
     22 
     23 Vasya also loves triangles, if the triangles have one vertex at point *B* = (0, 0). That's why today he asks you to find two points *A* = (*x*1, *y*1) and *C* = (*x*2, *y*2), such that the following conditions hold:
     24 
     25 * the coordinates of points: *x*1, *x*2, *y*1, *y*2 are integers. Besides, the following inequation holds: *x*1 < *x*2;
     26 * the triangle formed by point *A*, *B* and *C* is rectangular and isosceles (![](https://espresso.codeforces.com/2936a38a3166d972e7d168a8789cd9d5cc13bdd1.png) is right);
     27 * all points of the favorite rectangle are located inside or on the border of triangle *ABC*;
     28 * the area of triangle *ABC* is as small as possible.
     29 
     30 Help the bear, find the required points. It is not so hard to proof that these points are unique.
     31 
     32 Input
     33 
     34 The first line contains two integers *x*, *y* ( - 109 ≤ *x*, *y* ≤ 109, *x* ≠ 0, *y* ≠ 0).
     35 
     36 Output
     37 
     38 Print in the single line four integers *x*1, *y*1, *x*2, *y*2 — the coordinates of the required points.
     39 
     40 Examples
     41 
     42 Input
     43 
     44 ```
     45 10 5
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 0 15 15 0
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 -10 5
     58 ```
     59 
     60 Output
     61 
     62 ```
     63 -15 0 0 15
     64 ```
     65 
     66 Note
     67 
     68 ![](https://espresso.codeforces.com/b0a059bc4f258219d01f959bf2602a876634c961.png)
     69 
     70 Figure to the first sample