Submission #907889


Source Code Expand

n=int(raw_input())
a=map(int,raw_input().split())
maxa=max(a)
cmaxa=a.count(maxa)
ca=[0]*(maxa+1)
for i in xrange(n):
    ca[a[i]]+=1
if cmaxa==1:
    print("Impossible")
    exit()
if maxa%2==1:
    l=maxa/2+1
    if a.count(l)==2:
        for i in xrange(n):
            if a[i]<l or ca[a[i]]<2:
                print("Impossible")
                exit()
        print("Possible")
    else:
        print("Impossible")
else:
    l=maxa/2
    if a.count(l)==1:
        for i in xrange(n):
            if a[i]<l or ca[a[i]]<2:
                print("Impossible")
                exit()
        print("Possible")
    else:
        print("Impossible")

Submission Info

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 4
WA × 2
AC × 28
WA × 17
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 16 ms 2696 KB
almostline1 AC 16 ms 2696 KB
almostline2 AC 16 ms 2696 KB
almostline3 WA 16 ms 2696 KB
can0 WA 16 ms 2696 KB
can1 WA 16 ms 2696 KB
can2 WA 16 ms 2696 KB
can3 WA 16 ms 2696 KB
can4 WA 16 ms 2696 KB
can5 AC 16 ms 2696 KB
can6 AC 16 ms 2696 KB
deg0 AC 16 ms 2696 KB
deg1 WA 16 ms 2696 KB
deg2 AC 16 ms 2696 KB
deg3 WA 16 ms 2696 KB
example0 AC 16 ms 2696 KB
example1 AC 16 ms 2696 KB
example2 WA 16 ms 2696 KB
example3 AC 16 ms 2696 KB
example4 AC 16 ms 2696 KB
example5 WA 16 ms 2696 KB
handmade0 AC 16 ms 2696 KB
line0 AC 16 ms 2696 KB
line1 WA 16 ms 2696 KB
line2 AC 16 ms 2696 KB
line3 WA 16 ms 2696 KB
ng10 AC 16 ms 2696 KB
ng11 AC 16 ms 2696 KB
ng12 AC 16 ms 2696 KB
ng13 AC 16 ms 2696 KB
ng20 WA 16 ms 2696 KB
ng21 AC 16 ms 2696 KB
ng22 WA 16 ms 2696 KB
ng23 AC 16 ms 2696 KB
plus0 WA 16 ms 2696 KB
plus1 AC 16 ms 2696 KB
plus2 AC 16 ms 2696 KB
plus3 AC 16 ms 2696 KB
rand0 AC 16 ms 2696 KB
rand1 AC 16 ms 2696 KB
rand2 AC 16 ms 2696 KB
star0 WA 16 ms 2696 KB
star1 AC 16 ms 2696 KB
star2 WA 16 ms 2696 KB
star3 AC 16 ms 2696 KB