## TLE '16 Contest 8 P5 - Prom Night

View as PDF

Points: 15 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
A good prom-alternate activity (don't be a normie!).

Every male competitive programmer knows that finding a prom date is both more competitive and more difficult than any programming competition. It's almost time for prom, but the CS nerd still doesn't have a prom date! Of course, he really wants to take the girl out. Unfortunately, he knows this won't happen, so he won't go to the event. Despite this, he is still interested in his options for prom.

There are males and females in the school. Each male is willing to go to prom with a non-negative number of females. Every student is given an identification number. Males are numbered from to and females are separately numbered from to . The CS nerd's ID number is (and he is a male).

Other males will always get to choose a single female for their prom date before the CS nerd does. Once a female is chosen, another male cannot choose her. Males will always try to choose one female they are willing to go to prom with, but this is not always possible. The CS nerd then wonders to himself: "What is the minimum number of females I can choose from?" Can you help him out?

1 20
2 30
3 50

#### Input Specification

The first line of input will contain two integers, and .

lines of input follow. The first integer will be . space-separated integers follow, specifying the ID numbers of the females the male is willing to go to prom with. All of the ID numbers on each line will be distinct.

#### Output Specification

Output the minimum number of females that the CS nerd can choose from.

#### Sample Input 1

2 2
1 1
2 1 2

#### Sample Output 1

0

#### Explanation for Sample Output 1

If male chooses female , the CS nerd cannot choose any female.

#### Sample Input 2

3 3
3 1 2 3
3 1 2 3
3 1 2 3

#### Sample Output 2

1

#### Sample Input 3

3 4
2 1 2
1 2
2 2 4

#### Sample Output 3

1

• commented on Aug. 11, 2018, 3:56 p.m.

Sample input

5 10
10 1 2 3 4 5 6 7 8 9 10
1 1
1 1
1 1
1 1

= cs nerd has no standards

• commented on Sept. 8, 2017, 9:41 a.m.

This question is pure cringe...

• commented on March 6, 2018, 9:12 a.m.

I came to code! Not to be painfully reminded of my problems!

• commented on Sept. 8, 2017, 12:27 p.m.

No u

• commented on May 5, 2017, 2:23 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on May 30, 2017, 6:53 p.m.

50% of girls at CCO used pascal

• commented on May 30, 2017, 9:46 p.m.

Didn't the guy who beat d also use Pascal?

• commented on April 25, 2017, 9:44 p.m.

WA, can someone please tell me why I'm getting WA, am I missing anything?

• commented on April 22, 2017, 5:00 p.m.

CS nerd = Jim Gao

• commented on April 22, 2017, 6:38 p.m.

Life is hard sometimes.

• commented on April 20, 2017, 11:56 p.m.

The CS nerd then wonders to himself: "What is the minimum number of females I can choose from?"

I'm shocked that he can't get a date.

• commented on April 21, 2017, 9:45 a.m.

He needs to learn to go with the flow

• commented on May 30, 2017, 8:10 p.m.

He should consider learning the Ford–Fulkerson algorithm.