QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#759301#9701. CatthangthangWA 640ms3676kbC++201.5kb2024-11-18 00:26:462024-11-18 00:26:46

Judging History

This is the latest submission verdict.

  • [2024-11-18 00:26:46]
  • Judged
  • Verdict: WA
  • Time: 640ms
  • Memory: 3676kb
  • [2024-11-18 00:26:46]
  • Submitted

answer

// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

#define Mask(i)  (1ll << (i))
#define Bit(x, i)  ((x) >> (i) & 1)
#define bp __builtin_popcount
#define bpll __builtin_popcountll

void solve(){
    ll L, R, S; cin >> L >> R >> S;

    auto calc = [&](long long f) -> long long {
        long long ans = 0;
        for (int b = 0; b < 62; ++ b){
            long long x = Mask(b);
            if (!b){
                ll g = f / 2;
                if (g % 2 == 1) ans |= 1;
            }
            else {
                ll g = f / x;
                if (g % 2 == 1){
                    if ((f - g * x) % 2 == 1) ans |= x;
                }
            }
        }

        return ans;
    };

    ll xr = calc(R + 1) ^ calc(L);
    if (xr <= S) cout << R - L + 1 << endl;
    else {
        if (L == R) cout << -1 << endl;
        else cout << R - L << endl;
    }
}

int main(){
    if (fopen("pqh.inp", "r")){
        freopen("pqh.inp", "r", stdin);
        freopen("pqh.out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1; cin >> t;
    while (t --) solve();
    return 0;
}


详细

Test #1:

score: 0
Wrong Answer
time: 640ms
memory: 3676kb

input:

500000
28316250877914575 822981260158260522 1779547116602436425
335408917861648772 578223540024979445 74859962623690079
252509054433933447 760713016476190629 919845426262703496
522842184971407775 585335723211047202 148049062628894322
84324828731963982 354979173822804784 1001312150450968415
269587449...

output:

794665009280345948
242814622163330674
508203962042257183
62493538239639427
270654345090840803
376174809552329776
469882136957817192
42350729279043822
64865315101301174
697234070719324700
223517937810991678
108731400892235542
120906461794646288
463966315863716824
433607439314780607
450247658658833134...

result:

wrong answer 4th numbers differ - expected: '62493538239639426', found: '62493538239639427'