Submission #222817

# Submission time Handle Problem Language Result Execution time Memory
222817 2020-04-14T04:02:54 Z dantoh000 Popcount (COCI19_popcount) Python 3
110 / 110
33 ms 3556 KB
def main():
    n, K = map(int, input().split())
    code = []
    k = 0
    N = (1<<n)-1
    while (1 << k) < n:
        block = (1<<(1<<k))-1
        p = block;
        while p < (1<<n):
            p = p << (1<<(k+1))
            p = p | block
        p = p & N
        q = N ^ p
        code.append("A=((A&"+str(p)+")+((A&"+str(q)+")>>(1<<"+str(k)+")))")
        k += 1
    print(len(code))
    for x in code:
        print(x)                                              

main()
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3308 KB Accepted.
2 Correct 25 ms 3308 KB Accepted.
3 Correct 24 ms 3308 KB Accepted.
4 Correct 31 ms 3428 KB Accepted.
5 Correct 24 ms 3300 KB Accepted.
6 Correct 25 ms 3308 KB Accepted.
7 Correct 24 ms 3372 KB Accepted.
8 Correct 24 ms 3180 KB Accepted.
9 Correct 24 ms 3308 KB Accepted.
10 Correct 25 ms 3300 KB Accepted.
11 Correct 33 ms 3300 KB Accepted.
12 Correct 26 ms 3556 KB Accepted.
13 Correct 25 ms 3308 KB Accepted.
14 Correct 27 ms 3308 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 26 ms 3336 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 25 ms 3300 KB Accepted.
2 Correct 26 ms 3308 KB Accepted.
3 Correct 24 ms 3300 KB Accepted.
4 Correct 26 ms 3300 KB Accepted.
5 Correct 25 ms 3308 KB Accepted.
6 Correct 24 ms 3308 KB Accepted.
7 Correct 26 ms 3308 KB Accepted.
8 Correct 24 ms 3364 KB Accepted.
9 Correct 24 ms 3308 KB Accepted.
10 Correct 25 ms 3364 KB Accepted.
11 Correct 25 ms 3308 KB Accepted.
12 Correct 24 ms 3308 KB Accepted.
13 Correct 25 ms 3364 KB Accepted.
14 Correct 24 ms 3308 KB Accepted.
15 Correct 24 ms 3300 KB Accepted.
16 Correct 24 ms 3308 KB Accepted.
17 Correct 25 ms 3308 KB Accepted.
18 Correct 25 ms 3308 KB Accepted.
19 Correct 25 ms 3308 KB Accepted.
20 Correct 24 ms 3300 KB Accepted.
21 Correct 27 ms 3300 KB Accepted.
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3308 KB Accepted.
2 Correct 24 ms 3308 KB Accepted.
3 Correct 25 ms 3308 KB Accepted.
4 Correct 25 ms 3308 KB Accepted.
5 Correct 25 ms 3308 KB Accepted.
6 Correct 25 ms 3364 KB Accepted.
7 Correct 25 ms 3300 KB Accepted.
8 Correct 24 ms 3308 KB Accepted.
9 Correct 25 ms 3376 KB Accepted.
10 Correct 25 ms 3308 KB Accepted.
11 Correct 25 ms 3308 KB Accepted.
12 Correct 24 ms 3360 KB Accepted.