Reminder: in case of any technical issues, you can use the lightweight website m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

 
 
 
 
General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
53560113 Practice:
mnbvmar
1150C - 31 Python 3 Accepted 436 ms 3176 KB 2019-04-30 11:58:21 2019-04-30 11:58:21
 
 
→ Source
N = int(input())
num_ones = input().count('1')
num_twos = N - num_ones

if not num_ones or not num_twos:
    solution = [1] * num_ones + [2] * num_twos
else:
    solution = [2, 1] + [2] * (num_twos - 1) + [1] * (num_ones - 1)

print(*solution)

 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details