Submission #1111563

# Submission time Handle Problem Language Result Execution time Memory
1111563 2024-11-12T09:37:09 Z Bananabread CATS (NOI14_cats) C++17
25 / 25
294 ms 7916 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll q;
    cin>>q;
    while(q--){
        ll k,l,n;
        cin>>k>>l>>n;
        k--;
        ll c=(l/(2*n)+2);
        if(c>62) c=62;
        k%=(1LL<<c);
        cout<<2*n*(l/(2*n)+1)+(__builtin_popcountll(k)%2)<<"\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 336 KB Output is correct
2 Correct 25 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 247 ms 2120 KB Output is correct
2 Correct 294 ms 7916 KB Output is correct