# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
51677 |
2018-06-19T21:37:38 Z |
Kubalionzzale |
CATS (NOI14_cats) |
C++14 |
|
426 ms |
2632 KB |
#include <iostream>
#include <stack>
long long int popcount(long long int x)
{
long long int cnt = 0;
for (; x > 0; x >>= 1)
{
if (x & 1)
cnt = !cnt;
}
return cnt;
}
int main()
{
int q;
std::cin >> q;
while (q--)
{
long long int x, l, n;
std::cin >> x >> l >> n;
--x;
n *= 2;
long long int dis = ((l / n) + 1) * n;
n /= 2;
long long int period = (l + 2 * n - 1) / (2 * n);
if (period <= 60)
{
period = 2LL << period;
x %= period;
}
std::cout << dis + popcount(x) << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
496 KB |
Output is correct |
5 |
Correct |
2 ms |
552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
552 KB |
Output is correct |
2 |
Correct |
3 ms |
576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
576 KB |
Output is correct |
2 |
Correct |
3 ms |
576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
576 KB |
Output is correct |
2 |
Correct |
5 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
636 KB |
Output is correct |
2 |
Correct |
32 ms |
652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
387 ms |
2508 KB |
Output is correct |
2 |
Correct |
426 ms |
2632 KB |
Output is correct |