38952023-03-03 18:56:31horvathabelTáblajátékpython3Accepted 50/5017ms12916 KiB
k=int(input())
ans=0;
o=0;
a=[int(i) for i in input().split()]
for i in range(k):
    z=a[i]
    if (z==0):
        o+=1
        ans*=2
        
    if (z==1):
        o+=1
        ans*=2
        ans+=1
    if (z==2):
        o-=1
        ans//=2
    if (z==3):
        ans-=1
    if (z==4):
        ans+=1

print(o)
a=[]
if ans==0:
    a.append(0)
while ans>0:
    a.append(ans%2)
    ans//=2

a.reverse()
for i in a:
    print(i, end="")
    
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11164 KiB
2Accepted0/017ms11428 KiB
3Accepted3/317ms11556 KiB
4Accepted3/317ms12020 KiB
5Accepted3/317ms12080 KiB
6Accepted3/317ms12096 KiB
7Accepted3/317ms12496 KiB
8Accepted3/317ms12456 KiB
9Accepted3/317ms12576 KiB
10Accepted3/317ms12780 KiB
11Accepted3/317ms12652 KiB
12Accepted3/317ms12716 KiB
13Accepted4/417ms12900 KiB
14Accepted4/417ms12780 KiB
15Accepted4/417ms12628 KiB
16Accepted4/417ms12608 KiB
17Accepted4/417ms12916 KiB