All submissions for this problem are available.
You are responsible for conducting a fest in your college. Each student has told his choice for pop night, which he/ she wants and one he/she doesn’t want; of course they all understand that since there is only going to be one singer, no one is likely to have all their requirements satisfied. Can you call a singer that will satisfy at least one request from all your friends?
Input Code Teacher
A. Honey Singh
B. Atif Aslam
D. Annu Malik
E. Shreya Ghoshal
F. Mohit chauhan
G. Daler mehndi
J. Sonu Nigam
K. Abheejet Sawant
L. Sudesh Bhosle
M. Bryan Adams
N. Khelash Kher
Your friends provide you with a line of text that describes their preferences. For example, the line
reveals that someone will accept xyz, Iyer but not abc
indicates that someone else will not accept Shreya, Saleem and Annu, but Honey Singh or Sonu Nigam would be accepted
The input consists of a series of constraints.
A constraint is a list of 1 to 12 students choice lists.Each on a line by itself followed by a period on a line by itself.
A constraint list is a series of singers requests terminated by a single semicolon.
A request is a sign character (+/-) and then an uppercase letter from A to P.
For each constraint, provide a description of a singers that satisfies it. A description is the string "Singers: " in columns 1 through 10 and then a series of letters, in alphabetical order, listing the codes for singers possible. So, for listing possible singers as Shreya, Saleem and Annu, you need to print:
If no combination of singers can be found which satisfies at least one request of every person, your program should print the string
"Sorry" on a line by itself starting in column 1.
Input: +A+B+C+D-E-F-G-H; -A-B+C+D-E-F+G+H; -A+B-C+D-E+F-G+H; . +A+B+C+D; +E+F+F+H; +A+B-G; +O+J-F; +H+I+C; +P; +O+M+L; +M-L+P; . +A+B+C+D; +E+F+F+H; +A+B-G; +P-O; +O+J-F; +H+I+C; +P; +O; +O+M+L; -O-P; +M-L+P; . Output: Singers: Singers: CELP Sorry
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.