#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <numeric>
#include <limits>
using namespace std;
long long x, l, n;
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
int tests; cin >> tests; while (tests--)
{
cin >> x >> l >> n;
long long k = l / (2 * n) + 1;
x--;
bool cur = true;
long long i = k;
long long asdf = (x % 2) ^ (x / 2);
x /= 4;
while (--i && x)
{
if (cur)
{
asdf ^= x % 2;
}
else
{
asdf ^= x / 2;
x /= 4;
}
cur = !cur;
}
cout << 2 * k*n + (asdf&1) << endl;
}}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
0 ms |
1716 KB |
Output is correct |
3 |
Correct |
0 ms |
1716 KB |
Output is correct |
4 |
Correct |
0 ms |
1716 KB |
Output is correct |
5 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1716 KB |
Output is correct |
2 |
Correct |
6 ms |
1716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
1716 KB |
Output is correct |
2 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
77 ms |
1716 KB |
Output is correct |
2 |
Correct |
42 ms |
1716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
394 ms |
1716 KB |
Output is correct |
2 |
Correct |
431 ms |
1716 KB |
Output is correct |