Submission #1111672

# Submission time Handle Problem Language Result Execution time Memory
1111672 2024-11-12T14:34:32 Z Bananabread CATS (NOI14_cats) C++17
25 / 25
49 ms 7752 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    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 1 ms 336 KB Output is correct
2 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 3 ms 592 KB Output is correct
2 Correct 4 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 4728 KB Output is correct
2 Correct 49 ms 7752 KB Output is correct