Submission #49073320


Source Code Expand

/**
 *  @the_hyp0cr1t3
 *  06.01.2024 17:35
**/
#include <bits/stdc++.h>

int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);

    int n, Q;
    std::cin >> n >> Q;
    std::deque<std::pair<int, int>> q(n);
    for (int i = 0; i < n; i++)
        q[i] = {i + 1, 0};

    while (Q--) {
        int t;
        std::cin >> t;
        if (t == 1) {
            char c;
            std::cin >> c;
            auto [x, y] = q.front();
            if (c == 'L')
                x--;
            else if (c == 'R')
                x++;
            else if (c == 'D')
                y--;
            else if (c == 'U')
                y++;
            q.emplace_front(x, y);
        } else {
            int p;
            std::cin >> p;
            auto [x, y] = q[--p];
            std::cout << x << ' ' << y << '\n';
        }
    }

}

Submission Info

Submission Time
Task C - Loong Tracking
User the_hyp0cr1t3
Language C++ 20 (gcc 12.2)
Score 300
Code Size 883 Byte
Status AC
Exec Time 37 ms
Memory 13044 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 31
Set Name Test Cases
Sample sample_01.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, sample_01.txt
Case Name Status Exec Time Memory
random_01.txt AC 19 ms 12988 KiB
random_02.txt AC 13 ms 5444 KiB
random_03.txt AC 17 ms 12812 KiB
random_04.txt AC 11 ms 8576 KiB
random_05.txt AC 29 ms 12388 KiB
random_06.txt AC 28 ms 11424 KiB
random_07.txt AC 14 ms 11804 KiB
random_08.txt AC 6 ms 5356 KiB
random_09.txt AC 37 ms 11640 KiB
random_10.txt AC 33 ms 6376 KiB
random_11.txt AC 17 ms 11524 KiB
random_12.txt AC 12 ms 6156 KiB
random_13.txt AC 20 ms 4248 KiB
random_14.txt AC 1 ms 3464 KiB
random_15.txt AC 18 ms 13044 KiB
random_16.txt AC 18 ms 12908 KiB
random_17.txt AC 18 ms 12936 KiB
random_18.txt AC 18 ms 12948 KiB
random_19.txt AC 28 ms 12380 KiB
random_20.txt AC 27 ms 12320 KiB
random_21.txt AC 25 ms 12392 KiB
random_22.txt AC 27 ms 12284 KiB
random_23.txt AC 35 ms 11696 KiB
random_24.txt AC 35 ms 11660 KiB
random_25.txt AC 30 ms 11664 KiB
random_26.txt AC 34 ms 11704 KiB
random_27.txt AC 26 ms 12344 KiB
random_28.txt AC 26 ms 12340 KiB
random_29.txt AC 23 ms 12300 KiB
random_30.txt AC 26 ms 12340 KiB
sample_01.txt AC 1 ms 3412 KiB