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 <iostream>
#include <stack>
int main()
{
int q;
std::cin >> q;
while (q--)
{
int x, l, n;
std::cin >> x >> l >> n;
std::stack<int> s1;
int flipped = 0;
int t2 = 0;
s1.push(0);
s1.push(0);
int counter = x;
while (counter > 0)
{
t2 = s1.top() ^ flipped;
if (t2 > 1)
s1.pop();
flipped = !flipped;
if (t2 > l)
{
--counter;
if (counter == 0)
{
std::cout << t2 << "\n";
break;
}
}
else
{
s1.push((t2 + 2 * n) ^ flipped);
s1.push((t2 + 2 * n) ^ flipped);
}
}
}
}
# | 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... |