시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1321169595.000%

문제

An ultra-marathon is a race that takes place over an uncomfortably long distance and time, typically lasting for five hours or more. You are part of a group of three ultra-marathon runners looking to place in this year's Great South-to-North run from Plymouth to Aberdeen.

You have a set number of days until the next race to train. You will all train together, as training alone can be dangerous. As everyone has their own schedule in mind for how many kilometres to run per day, this will not be easy, you will have to compromise.

The fairest option is to look at each day individually, examine the three options for how far to run, and to take the median one. That is to say, the option taken for each day should be one that is not be greater or lesser than both of the other possibilities at the same time.

입력

  • A line with the integer $n$ ($1\leq n\leq1000$), the number of days of training.
  • A line with $n$ integers $k_{1,\ldots,n}$ ($0\leq k \leq 10^6$), your ideal daily distances.
  • A line with $n$ integers $a_{1,\ldots,n}$ ($0\leq a \leq 10^6$), your first colleague's ideal daily distances.
  • A line with $n$ integers $b_{1,\ldots,n}$ ($0\leq b \leq 10^6$), your second colleague's ideal daily distances.

출력

Output a plan for the $n$ days as $n$ integers, where the distance for every day corresponds to the median of choices for that day.

예제 입력 1

4
1 2 3 4
4 3 2 1
2 2 2 2

예제 출력 1

2 2 2 2

예제 입력 2

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

예제 출력 2

2 6 1 8 2 8

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2020 M번

  • 문제를 만든 사람: Robin Lee