# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
51675 |
2018-06-19T21:36:03 Z |
Kubalionzzale |
CATS (NOI14_cats) |
C++14 |
|
402 ms |
3240 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);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
402 ms |
3240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |