시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 1024 MB | 29 | 16 | 16 | 55.172% |
Welcome to the Number Colosseum, where two teams of integers are preparing to battle! On the left side of the number line we have team Negatives while on the right side we have team Positives. Every integer fighting in the colosseum is on one of these two teams.
At the start of the battle, the contestants line up outside the colosseum. One by one, the contestants enter the colosseum and follow these rules:
After all of the integers have entered the colosseum, only one team may be declared the winners of the Number Colosseum! Given the lineup of contestants for the upcoming battle, write a program to determine which team will triumph as well as the state of the colosseum after all fights have occurred.
The first line contains a single integer $N$ ($1≤N≤5⋅10^5$), which is the number of contestants who will enter the colosseum. The second line contains the lineup of contestants. This will contain $N$ space-separated integers $x_1,x_2, \dots ,x_N$ ($1≤|x_i|≤10^6$ for each $1≤i≤N$), the value of the $i$th contestant entering the colosseum.
Display the winning team with either Positives win!
or Negatives win!
. On the following line display the list of integers remaining in the colosseum after all fighting has finished. Display these integers in the order of arrival into the colosseum.
If neither team wins, display Tie!
instead.
4 -3 -4 9 1
Positives win! 2 1
7 4 -2 -2 2 -1 -1 -1
Negatives win! -1
6 10 -2 -2 -2 -2 -2
Tie!
In Sample Input $1$, $N=4$ and the contestants have lined up in this order $[-3,-4,9,1]$.
University > University of Alberta Programming Contest > UAPC 2022 G번