Submission #49069561


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, q;
cin >> n >> q;
vector<pair<int, int>> t;
for (int i = n; i >= 1; i--) t.push_back({i, 0});
while (q--) {
int type, idx;
char c;
cin >> type;
if (type == 1) {
cin >> c;
int x = t.back().first, y = t.back().second;
if (c == 'U') {
y++;
} else if (c == 'L') x--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<pair<int, int>> t;
    for (int i = n; i >= 1; i--) t.push_back({i, 0});
    while (q--) {
        int type, idx;
        char c;
        cin >> type;
        if (type == 1) {
            cin >> c;
            int x = t.back().first, y = t.back().second;
            if (c == 'U') {
                y++;
            } else if (c == 'L') x--;
            else if (c == 'R') x++;
            else y--;
            t.push_back({x, y});
        } else {
            cin >> idx;
            cout << t[t.size() - idx].first << ' ' << t[t.size() - idx].second << '\n';
        }
    }
}

Submission Info

Submission Time
Task C - Loong Tracking
User Sharky
Language C++ 20 (gcc 12.2)
Score 300
Code Size 780 Byte
Status AC
Exec Time 49 ms
Memory 36224 KB

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 33 ms 36180 KB
random_02.txt AC 15 ms 7288 KB
random_03.txt AC 30 ms 36104 KB
random_04.txt AC 19 ms 19500 KB
random_05.txt AC 45 ms 36108 KB
random_06.txt AC 38 ms 19504 KB
random_07.txt AC 21 ms 19668 KB
random_08.txt AC 8 ms 7208 KB
random_09.txt AC 49 ms 19504 KB
random_10.txt AC 37 ms 11456 KB
random_11.txt AC 26 ms 19508 KB
random_12.txt AC 15 ms 11400 KB
random_13.txt AC 19 ms 5200 KB
random_14.txt AC 1 ms 3600 KB
random_15.txt AC 31 ms 36064 KB
random_16.txt AC 31 ms 36224 KB
random_17.txt AC 30 ms 36100 KB
random_18.txt AC 33 ms 36100 KB
random_19.txt AC 39 ms 36116 KB
random_20.txt AC 39 ms 36068 KB
random_21.txt AC 37 ms 36180 KB
random_22.txt AC 39 ms 36072 KB
random_23.txt AC 39 ms 19564 KB
random_24.txt AC 39 ms 19600 KB
random_25.txt AC 36 ms 19668 KB
random_26.txt AC 39 ms 19676 KB
random_27.txt AC 38 ms 36068 KB
random_28.txt AC 38 ms 36064 KB
random_29.txt AC 35 ms 36020 KB
random_30.txt AC 38 ms 36088 KB
sample_01.txt AC 1 ms 3468 KB


2025-03-05 (Wed)
12:33:06 +00:00