L
L
love_energy2017-09-20 12:18:23
Programming
love_energy, 2017-09-20 12:18:23

Olympiad problem about People. How to solve this problem?

There are N people and integers A1, ..., AN; person i must be introduced to people ai. Can it be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2017-09-20
@love_energy

I see that you have all the questions about the Olympiad problems, but it’s hard to answer them.
My advice is to take problems where you can find their analysis and / or see solutions, like on codeforces .
Here is the solution to this problem in python3:

xy = ({""}, {""})
for _ in range(int(input())):
    for i, t in enumerate(input().split()):
        xy[i].add(t)
print(max(map(len, xy)) // 2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question