Problem C
Kuggfrågan
Tyko is about to start kindergarten so Maj and Måns have started looking for options. During a visit to one of the kindergartens Tyko noticed a poster on the wall. It was one of those usual PR posters on how well the the teachers, kids and parents worked together. However, on this one they tried to do it with gears. While this may seem like a cute metaphor, the gears on this particular poster don’t actually work together. Realizing this, there is no way Tyko would attend this kindergarten. Similar posters appeared at a few other places too but with increased complexity. The increased complexity is a bit too hard for a one year old to analyze, even for Tyko. So now Tyko needs your help to construct a program which can check if the posters are working or not.
Input
The first line of input contains two integers $N$ and $M$ ($2 \leq N \leq 100,000$ and $1 \leq M \leq 2,000,000$).
The following $M$ lines describe a connection between two gears. Each such line contains two integers $u$ and $v$ ($0 \leq u, v < N$, $u \ne v$), which means gears $u$ and $v$ are connected.
Output
A string containing "attend here" if the gears would work together or "no way" if they don’t.
Scoring
Group |
Points |
Limits |
1 |
20 |
$N \leq 10$ |
2 |
40 |
$N \leq 1\, 000$ |
3 |
40 |
No further restrictions |
Sample Input 1 | Sample Output 1 |
---|---|
3 3 0 1 1 2 2 0 |
no way |
Sample Input 2 | Sample Output 2 |
---|---|
2 1 0 1 |
attend here |