Submission #222556

#TimeUsernameProblemLanguageResultExecution timeMemory
222556lycPopcount (COCI19_popcount)Cpython 3
110 / 110
31 ms3436 KiB
N, K = map(int, input().split())
code = []

seg = 1
while seg < N:
    mask = []
    i = 0
    p = 0
    while i < N:
        p |= ((1<<seg)-1) << i
        i += 2*seg
    p &= (1<<N)-1
    q = (p<<seg) & ((1<<N)-1)

    code.append('A=((A&{})+((A&{})>>{}))'.format(p,q,seg))
    seg <<= 1

print(len(code))
for c in code:
    print(c)

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...