codeforces-scrape

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

39D.md (1155B)


      1 Source: https://codeforces.com/problemset/problem/39/D
      2 
      3 D. Cubical Planet
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 64 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 You can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us introduce a system of axes so that the edges of the cubical planet are parallel to the coordinate axes and two opposite vertices lay in the points (0, 0, 0) and (1, 1, 1). Two flies live on the planet. At the moment they are sitting on two different vertices of the cubical planet. Your task is to determine whether they see each other or not. The flies see each other when the vertices they occupy lie on the same face of the cube.
     22 
     23 Input
     24 
     25 The first line contains three space-separated integers (0 or 1) — the coordinates of the first fly, the second line analogously contains the coordinates of the second fly.
     26 
     27 Output
     28 
     29 Output "YES" (without quotes) if the flies see each other. Otherwise, output "NO".
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 0 0 0  
     37 0 1 0
     38 ```
     39 
     40 Output
     41 
     42 ```
     43 YES
     44 ```
     45 
     46 Input
     47 
     48 ```
     49 1 1 0  
     50 0 1 0
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 YES
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 0 0 0  
     63 1 1 1
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 NO
     70 ```