codeforces-scrape

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

94B.md (1904B)


      1 Source: https://codeforces.com/problemset/problem/94/B
      2 
      3 B. Friends
      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 One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something.
     22 
     23 The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people"
     24 
     25 Igor just couldn't get why the required minimum is 6 people. "Well, that's the same for five people, too!" — he kept on repeating in his mind. — "Let's take, say, Max, Ilya, Vova — here, they all know each other! And now let's add Dima and Oleg to Vova — none of them is acquainted with each other! Now, that math is just rubbish!"
     26 
     27 Igor K. took 5 friends of his and wrote down who of them is friends with whom. Now he wants to check whether it is true for the five people that among them there are either three pairwise acquainted or three pairwise not acquainted people.
     28 
     29 Input
     30 
     31 The first line contains an integer *m* (0 ≤ *m* ≤ 10), which is the number of relations of acquaintances among the five friends of Igor's.
     32 
     33 Each of the following *m* lines contains two integers *a**i* and *b**i* (1 ≤ *a**i*, *b**i* ≤ 5;*a**i* ≠ *b**i*), where (*a**i*, *b**i*) is a pair of acquainted people. It is guaranteed that each pair of the acquaintances is described exactly once. The acquaintance relation is symmetrical, i.e. if *x* is acquainted with *y*, then *y* is also acquainted with *x*.
     34 
     35 Output
     36 
     37 Print "FAIL", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print "WIN".
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 4  
     45 1 3  
     46 2 3  
     47 1 4  
     48 5 3
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 WIN
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 5  
     61 1 2  
     62 2 3  
     63 3 4  
     64 4 5  
     65 5 1
     66 ```
     67 
     68 Output
     69 
     70 ```
     71 FAIL
     72 ```