spoj#BAPPP. Power Play
Power Play
Description:
As we are a “CricketPagol” (loves cricket a lot) nation , we know a lot about Cricket. So Mr. GoodForNothing , a fan of great cricketer Mashrafee think to develop an app that can found an interesting error in the game by visual effect.We all know about power play. Power play is the name for fielding restriction. Suppose, here are the rules of power play in ODI:
1. During P-1(1 to 10 overs) maximum of 2 fielders are allowed outside the inner circle.
2. During P-2(11 to 40 overs) maximum of 4 fielders are allowed outside the inner circle.
3. During P-3(41 to 50 overs) maximum of 3 fielders are allowed outside the inner circle.
You know, there are two circles in the ground. We know that you are a programmer. So, you don’t have to develop the app. For simplifying the problem, you will be given the number of running over. And many pair of cricketer which denotes that they are in the same circle. You have to write a program that will identify that is there error occurs in fielder configuration or not? And we also give you the name of the wicket keeper.
Note that the wicket keeper is always in inner circle. And there can be eleven different cricketer names always.
Input
The first line contains two integer n (1 <= n <= 50) and m ( 10 <= m <= 50) which denotes that nth over is running now and number of pair of cricketer in the same circle respectively.
The second line contains the name of the wicket keeper.
The next m lines contain m pair of name of the cricketers.
Output
Print “Error” if there are error in fielder configuration. And print “No Error” otherwise.
Example
Input:3 12
Mushfique
Mashrafee Sakib
Sakib Mushfique
Mashrafee Mushfique
Mashrafee Taijul
Taijul Mahmudullah
Taijul Rubel
Mahmudullah Mustafiz
Liton Imrul
Rubel Mustafiz
Liton Anamul
Mustafiz Tamim
Tamim Sakib
Output:Error
As we are a “CricketPagol” (loves cricket a lot) nation , we know a lot about Cricket. So Mr. Mamachika , a fan of great cricketer Mozahid think to develop an app that can found an interesting error in the game by visual effect. We all know about power play. Power play is the name for fielding restriction. Suppose, here are the rules of power play in ODI:
1. During P-1(1 to 10 overs) maximum of 2 fielders are allowed outside the inner circle.
2. During P-2(11 to 40 overs) maximum of 6 fielders are allowed inside the inner circle.
3. During P-3(41 to 50 overs) maximum of 3 fielders are allowed outside the inner circle.
You know, there are two circles in the ground. We know that you are a programmer. So, you don’t have to develop the app. For simplifying the problem, you will be given the number of running over. And many pair of cricketer which denotes that they are in the same circle. You have to write a program that will identify that is there error occurs in fielder configuration or not? And we also give you the name of the wicket keeper.
Note that the wicket keeper is always in inner circle. And there can be eleven different cricketer names always.