Submission #222556

# Submission time Handle Problem Language Result Execution time Memory
222556 2020-04-13T10:41:02 Z lyc Popcount (COCI19_popcount) Python 3
110 / 110
31 ms 3436 KB
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 time Memory Grader output
1 Correct 24 ms 3308 KB Accepted.
2 Correct 24 ms 3308 KB Accepted.
3 Correct 24 ms 3308 KB Accepted.
4 Correct 24 ms 3308 KB Accepted.
5 Correct 23 ms 3308 KB Accepted.
6 Correct 24 ms 3308 KB Accepted.
7 Correct 29 ms 3396 KB Accepted.
8 Correct 24 ms 3308 KB Accepted.
9 Correct 23 ms 3308 KB Accepted.
10 Correct 24 ms 3308 KB Accepted.
11 Correct 24 ms 3292 KB Accepted.
12 Correct 24 ms 3308 KB Accepted.
13 Correct 24 ms 3308 KB Accepted.
14 Correct 26 ms 3436 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3332 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3308 KB Accepted.
2 Correct 24 ms 3308 KB Accepted.
3 Correct 24 ms 3308 KB Accepted.
4 Correct 24 ms 3300 KB Accepted.
5 Correct 24 ms 3308 KB Accepted.
6 Correct 24 ms 3308 KB Accepted.
7 Correct 24 ms 3308 KB Accepted.
8 Correct 25 ms 3436 KB Accepted.
9 Correct 26 ms 3300 KB Accepted.
10 Correct 24 ms 3308 KB Accepted.
11 Correct 25 ms 3308 KB Accepted.
12 Correct 24 ms 3308 KB Accepted.
13 Correct 24 ms 3308 KB Accepted.
14 Correct 25 ms 3348 KB Accepted.
15 Correct 25 ms 3308 KB Accepted.
16 Correct 25 ms 3300 KB Accepted.
17 Correct 24 ms 3300 KB Accepted.
18 Correct 24 ms 3308 KB Accepted.
19 Correct 24 ms 3308 KB Accepted.
20 Correct 24 ms 3292 KB Accepted.
21 Correct 26 ms 3308 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3308 KB Accepted.
2 Correct 31 ms 3308 KB Accepted.
3 Correct 24 ms 3300 KB Accepted.
4 Correct 25 ms 3344 KB Accepted.
5 Correct 24 ms 3308 KB Accepted.
6 Correct 24 ms 3308 KB Accepted.
7 Correct 24 ms 3300 KB Accepted.
8 Correct 24 ms 3308 KB Accepted.
9 Correct 24 ms 3292 KB Accepted.
10 Correct 24 ms 3308 KB Accepted.
11 Correct 24 ms 3292 KB Accepted.
12 Correct 24 ms 3308 KB Accepted.