#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9+9;
const int MAXN = 1000006;
int n, l, x, t, arr[MAXN];
int f(int n, int l, int x) {
vi s1;
int s2 = 0;
int c = 0;
while (x > 0) {
if (s1.empty())
s1.push_back(c);
s2 = s1.back();
s1.pop_back();
for (auto& v : s1) {
v ^= 1;
}
c ^= 1;
if (s2 > l) {
if (--x == 0) {
return s2;
}
} else {
s2 += 2*n;
s1.push_back(s2);
s1.push_back(s2);
}
}
return 0;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> t;
while (t--) {
cin >> x >> l >> n;
// cerr << f(n, l, x) << "\n";
n<<=1;
int k = l/n+1;
int ans = k*n;
--x;
for (int i = 0, p = 1; i <= k; p <<=1, ++i) {
ans ^= ((x&p) == 0);
}
ans ^= ((k&1) == 0);
cout << ans << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
97 ms |
504 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1594 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
512 KB |
Execution killed with signal 8 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |