38942023-03-03 18:55:27horvathabelTáblajátékpython3Partially correct 43/5017ms13148 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=[]
while ans>0:
    a.append(ans%2)
    ans//=2
a.reverse()
for i in a:
    print(i, end="")
    
SubtaskSumTestVerdictTimeMemory
base43/50
1Accepted0/017ms11240 KiB
2Accepted0/017ms11596 KiB
3Partially correct1/317ms11360 KiB
4Accepted3/317ms11904 KiB
5Accepted3/317ms12100 KiB
6Accepted3/317ms12260 KiB
7Accepted3/317ms12168 KiB
8Accepted3/317ms12616 KiB
9Partially correct1/317ms12664 KiB
10Accepted3/317ms12428 KiB
11Accepted3/317ms12640 KiB
12Accepted3/317ms12748 KiB
13Accepted4/417ms12704 KiB
14Accepted4/417ms12880 KiB
15Accepted4/417ms13032 KiB
16Accepted4/417ms12996 KiB
17Partially correct1/417ms13148 KiB