Submission #1356741


Source Code Expand

p = "Possible"
imp = "Impossible"

n = int(raw_input())
a = map(int, raw_input().split())
mx = max(a)
mn = min(a)
if mx == mn:
    if n == 2:
        print p
        exit()
    else:
        print imp
        exit()
cnt=[0] * 100
for i in xrange(n):
    cnt[a[i]] += 1
if mx % 2 == 0:
    if mx / 2 != mn:
        print imp
        exit()
    if cnt[mn] != 1:
        print imp
        exit()
    for i in xrange(mn + 1, mx + 1):
        if cnt[i] < 2:
            print imp
            exit()

else:
    if mx / 2 + 1 != mn:
        print imp
        exit()
    if cnt[mn] == 1:
        print imp
        exit()
    for i in xrange(mn + 1, mx + 1):
        if cnt[i] < 2:
            print imp
            exit()
print p

Submission Info

Submission Time
Task C - Tree Restoring
User roto_37
Language Python (2.7.6)
Score 0
Code Size 763 Byte
Status WA
Exec Time 11 ms
Memory 2820 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 6
AC × 43
WA × 2
Set Name Test Cases
Sample example0, example1, example2, example3, example4, example5
All almostline0, almostline1, almostline2, almostline3, can0, can1, can2, can3, can4, can5, can6, deg0, deg1, deg2, deg3, example0, example1, example2, example3, example4, example5, handmade0, line0, line1, line2, line3, ng10, ng11, ng12, ng13, ng20, ng21, ng22, ng23, plus0, plus1, plus2, plus3, rand0, rand1, rand2, star0, star1, star2, star3
Case Name Status Exec Time Memory
almostline0 AC 11 ms 2696 KB
almostline1 AC 11 ms 2696 KB
almostline2 AC 11 ms 2696 KB
almostline3 AC 11 ms 2696 KB
can0 AC 11 ms 2696 KB
can1 AC 11 ms 2696 KB
can2 AC 11 ms 2696 KB
can3 AC 11 ms 2696 KB
can4 AC 11 ms 2696 KB
can5 AC 11 ms 2696 KB
can6 AC 11 ms 2696 KB
deg0 AC 11 ms 2696 KB
deg1 AC 11 ms 2696 KB
deg2 AC 11 ms 2696 KB
deg3 AC 11 ms 2820 KB
example0 AC 11 ms 2696 KB
example1 AC 11 ms 2696 KB
example2 AC 11 ms 2696 KB
example3 AC 11 ms 2696 KB
example4 AC 11 ms 2696 KB
example5 AC 11 ms 2696 KB
handmade0 AC 11 ms 2696 KB
line0 AC 11 ms 2696 KB
line1 AC 11 ms 2696 KB
line2 AC 11 ms 2696 KB
line3 AC 11 ms 2696 KB
ng10 WA 11 ms 2696 KB
ng11 AC 11 ms 2696 KB
ng12 WA 11 ms 2696 KB
ng13 AC 11 ms 2696 KB
ng20 AC 11 ms 2696 KB
ng21 AC 11 ms 2696 KB
ng22 AC 11 ms 2696 KB
ng23 AC 11 ms 2696 KB
plus0 AC 11 ms 2696 KB
plus1 AC 11 ms 2696 KB
plus2 AC 11 ms 2696 KB
plus3 AC 11 ms 2696 KB
rand0 AC 11 ms 2696 KB
rand1 AC 11 ms 2696 KB
rand2 AC 11 ms 2696 KB
star0 AC 11 ms 2696 KB
star1 AC 11 ms 2696 KB
star2 AC 11 ms 2696 KB
star3 AC 11 ms 2696 KB