Submission #51372

# Submission time Handle Problem Language Result Execution time Memory
51372 2018-06-17T18:05:22 Z Kubalionzzale CATS (NOI14_cats) C++14
0 / 25
441 ms 2400 KB
#include <iostream>
#include <stack>

int main()
{
    int q;
    std::cin >> q;

    while (q--)
    {
        long long int x, l, n;
        std::cin >> x >> l >> n;

        if (n % l == 0)
        {
            n *= 2;
            long long int dis = ((l / n) + 1) * n;

            if (x % 6 == 0 || x % 6 == 4)
            {
                std::cout << dis << "\n";
            }
            else if (x % 6 == 1 || x % 6 == 5)
            {
                std::cout << dis + 1 << "\n";
            }
            else
            {
                std::cout << l + 1 << "\n";
            }
        }
        else
        {
            n *= 2;
            long long int dis = ((l / n) + 1) * n;

            if (x % 4 == 0 || x % 4 == 3)
            {
                std::cout << dis << "\n";
            }
            else
            {
                std::cout << dis + 1 << "\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;
                std::cout << t2 << " ";
                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
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 441 ms 2400 KB Output isn't correct
2 Halted 0 ms 0 KB -