답안 #198411

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198411 2020-01-26T00:05:18 Z model_code Popcount (COCI19_popcount) Python 3
110 / 110
17 ms 2980 KB
#!/usr/bin/python3

def main():
    n, k = map(int, input().split())
    code = []
    i = 0
    while (1 << i) < n:
        p = (1 << (1 << i)) - 1
        while p < (1 << n):
            p = p << (1 << (i + 1)) | ((1 << (1 << i)) - 1)
        p &= (1 << n) - 1
        q = ((1 << (1 << i)) - 1) << (1 << i)
        while q < (1 << n):
            q = q << (1 << (i + 1)) | ((1 << (1 << i)) - 1) << (1 << i)
        q &= (1 << n) - 1
        code.append("A=((A&" + str(p) + ")+((A&" + str(q) + ")>>(1<<" + str(i) + ")))")
        i += 1

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


if __name__ == '__main__':
    main()
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2880 KB Accepted.
2 Correct 13 ms 2900 KB Accepted.
3 Correct 13 ms 2900 KB Accepted.
4 Correct 13 ms 2892 KB Accepted.
5 Correct 13 ms 2912 KB Accepted.
6 Correct 16 ms 2796 KB Accepted.
7 Correct 13 ms 2824 KB Accepted.
8 Correct 13 ms 2900 KB Accepted.
9 Correct 12 ms 2912 KB Accepted.
10 Correct 13 ms 2884 KB Accepted.
11 Correct 13 ms 2900 KB Accepted.
12 Correct 14 ms 2900 KB Accepted.
13 Correct 13 ms 2912 KB Accepted.
14 Correct 13 ms 2912 KB Accepted.
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2912 KB Accepted.
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2900 KB Accepted.
2 Correct 13 ms 2772 KB Accepted.
3 Correct 13 ms 2896 KB Accepted.
4 Correct 17 ms 2772 KB Accepted.
5 Correct 13 ms 2900 KB Accepted.
6 Correct 13 ms 2900 KB Accepted.
7 Correct 12 ms 2772 KB Accepted.
8 Correct 13 ms 2804 KB Accepted.
9 Correct 13 ms 2772 KB Accepted.
10 Correct 13 ms 2980 KB Accepted.
11 Correct 13 ms 2776 KB Accepted.
12 Correct 13 ms 2892 KB Accepted.
13 Correct 12 ms 2900 KB Accepted.
14 Correct 13 ms 2900 KB Accepted.
15 Correct 14 ms 2892 KB Accepted.
16 Correct 13 ms 2772 KB Accepted.
17 Correct 13 ms 2900 KB Accepted.
18 Correct 13 ms 2900 KB Accepted.
19 Correct 12 ms 2888 KB Accepted.
20 Correct 12 ms 2812 KB Accepted.
21 Correct 13 ms 2900 KB Accepted.
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2772 KB Accepted.
2 Correct 15 ms 2852 KB Accepted.
3 Correct 13 ms 2900 KB Accepted.
4 Correct 13 ms 2900 KB Accepted.
5 Correct 13 ms 2872 KB Accepted.
6 Correct 12 ms 2772 KB Accepted.
7 Correct 13 ms 2900 KB Accepted.
8 Correct 13 ms 2884 KB Accepted.
9 Correct 12 ms 2772 KB Accepted.
10 Correct 14 ms 2904 KB Accepted.
11 Correct 12 ms 2896 KB Accepted.
12 Correct 14 ms 2892 KB Accepted.