# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290822 | gs14004 | CATS (NOI14_cats) | C++17 | 89 ms | 6264 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cstring>
using lint = long long;
struct cat_stack{
int stack[5000005], sz;
int top(){
if(sz == 0) return 0;
return stack[sz-1];
}
void pop(){
if(sz != 0) sz--;
}
void push(int x){
stack[sz++] = x;
}
}s1;
int main(){
int q;
scanf("%d",&q);
while (q--) {
lint x, l, n;
scanf("%lld %lld %lld",&x,&l,&n);
x--;
lint Q = l / (2 * n) + 2;
if(Q <= 61){
x %= (1ll << Q);
}
int g = __builtin_popcount(x) % 2;
printf("%lld\n", (Q - 1) * (2 * n) + g);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |