Olympic Sinh Viên 2020 - Chuyên tin - Sơn phản quang

View as PDF

Submit solution

Points: 0.05 (partial)
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem source:
Olympic Sinh Viên
Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

In case the statement didn't load correctly, you can download the statement here: Statement

Lưu ý: Đọc dữ liệu từ stdin, viết dữ liệu ra stdout.


Comments

Please read the guidelines before commenting.



  • 0
    vominhmanh10  commented on Dec. 24, 2025, 12:25 p.m. edited

    với n <= 10^18, k chỉ cần xét dưới 60 là đủ
    duyệt k và đếm những ô thỏa mãn sẽ được sơn thêm 1 tầng nữa

    import sys
    input = sys.stdin.readline
    l, r = map(int, input().split())
    ans = 0
    for k in range(1, 60):
        L = (l - 1) // (1 << k)
        R = r // (1 << k)
        ans += R - L
    print(ans)
    

  • 3
    SPyofgame  commented on Sept. 4, 2021, 12:24 p.m. edited

    Unofficial Solution:

    https://hackmd.io/@Editorial-Slayers/olp_ct20_reflective - Click