QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#515486#3812. Sheldon NumbersBacily#WA 1ms3864kbC++231.3kb2024-08-11 18:00:102024-08-11 18:00:10

Judging History

你现在查看的是最新测评结果

  • [2024-08-11 18:00:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3864kb
  • [2024-08-11 18:00:10]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
#define sz(x) (int)x.size()
#define lll __int128
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


void func() {
    long long x, y;
    cin >> x >> y;
    set<long long> st;
    for (int n = 1; n <= 63; n++) {
        for (int m = 1; m <= 63; m++) {
            lll ans = 0;
            bool curr = 0;
            int sum = 0;
            while (sum <= 63) {

                if (curr) {
                    lll new_ans = (ans << m);
                    if (new_ans > (lll) y and sum + m <= 63) {
                        break;
                    } else {
                        ans = new_ans;
                        sum += m;
                    }
                } else {
                    lll new_ans = (ans << n) + (1ll << n) - 1;
                    if (new_ans > (lll) y and sum + n <= 63)break;
                    else ans = new_ans, sum += n;
                }
                if (ans >= x and ans <= y) {
                    st.insert(ans);
                }
                curr ^= 1;
            }
        }
    }
    cout << sz(st) << '\n';
}

int main() {

    int t = 1;
    //cin >> t;
    for (int i = 0; i < t; i++) {
        func();
    }
}
// 5 3 1 2 4

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3508kb

input:

1 10

output:

10

result:

ok single line: '10'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

70 75

output:

1

result:

ok single line: '1'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3864kb

input:

0 9223372036854775807

output:

4808

result:

wrong answer 1st lines differ - expected: '4809', found: '4808'