codeforces-scrape

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

817A.md (2148B)


      1 Source: https://codeforces.com/problemset/problem/817/A
      2 
      3 A. Treasure Hunt
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure.
     22 
     23 Bottle with potion has two values *x* and *y* written on it. These values define four moves which can be performed using the potion:
     24 
     25 * ![](https://espresso.codeforces.com/ca0e2ade7d6ceea673d731c6dc116c814776df94.png)
     26 * ![](https://espresso.codeforces.com/58e9516054e46ba5c263ff97be1d42c210432a50.png)
     27 * ![](https://espresso.codeforces.com/d3a36e5eb47a11f1a47d9b6889e22202c5ac602f.png)
     28 * ![](https://espresso.codeforces.com/c60349e088498550b4b6728417a78afecd913356.png)
     29 
     30 Map shows that the position of Captain Bill the Hummingbird is (*x*1, *y*1) and the position of the treasure is (*x*2, *y*2).
     31 
     32 You task is to tell Captain Bill the Hummingbird whether he should accept this challenge or decline. If it is possible for Captain to reach the treasure using the potion then output "YES", otherwise "NO" (without quotes).
     33 
     34 The potion can be used infinite amount of times.
     35 
     36 Input
     37 
     38 The first line contains four integer numbers *x*1, *y*1, *x*2, *y*2 ( - 105 ≤ *x*1, *y*1, *x*2, *y*2 ≤ 105) — positions of Captain Bill the Hummingbird and treasure respectively.
     39 
     40 The second line contains two integer numbers *x*, *y* (1 ≤ *x*, *y* ≤ 105) — values on the potion bottle.
     41 
     42 Output
     43 
     44 Print "YES" if it is possible for Captain to reach the treasure using the potion, otherwise print "NO" (without quotes).
     45 
     46 Examples
     47 
     48 Input
     49 
     50 ```
     51 0 0 0 6  
     52 2 3
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 YES
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 1 1 3 6  
     65 1 5
     66 ```
     67 
     68 Output
     69 
     70 ```
     71 NO
     72 ```
     73 
     74 Note
     75 
     76 In the first example there exists such sequence of moves:
     77 
     78 1. ![](https://espresso.codeforces.com/7c939890fb4ed35688177327dac981bfa9216c00.png) — the first type of move
     79 2. ![](https://espresso.codeforces.com/afbfa42fbac4e0641e7466e3aac74cbbb08ed597.png) — the third type of move