Submission #49078200


Source Code Expand

#include <assert.h>

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = a; i < b; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, a) rrepi(i, a, 0)
#define rrepi(i, a, b) for (ll i = a - 1; i >= b; --i)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(), (V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
inline void Yes(bool condition) {
    if (condition)
        PRINT("Yes");
    else
        PRINT("No");
}
template <class itr>
void cins(itr first, itr last) {
    for (auto i = first; i != last; i++) {
        cin >> (*i);
    }
}
template <class itr>
void array_output(itr start, itr goal) {
    string ans = "", k = " ";
    for (auto i = start; i != goal; i++) ans += to_string(*i) + k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; }

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a) { return (a < -EPS ? -1 : (a > EPS ? +1 : 0)); }
typedef pair<int, int> pi;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> tri;
typedef pair<double, double> point;
typedef complex<double> Point;
const ll MAX = 1000005;
constexpr ll nx[4] = {1, -1, 0, 0};
constexpr ll ny[4] = {0, 0, 1, -1};

int main() {
    ll n,q;
    cin >> n >> q;
    deque<P> r;
    rep(i,n){
        r.push_back(P(i+1,0));
    }
    rep(i,q){
        ll s;
        cin >> s;
        if (s == 1){
            char c;
            cin >> c;
            ll num = 0;
            if (c == 'R'){
                num = 0;
            }
            else if (c == 'L'){
                num = 1;
            }
            else if (c == 'U'){
                num = 2;
            }
            else if (c == 'D'){
                num = 3;
            }
            auto tmp = r.front();
            r.pop_back();
            r.push_front(P(tmp.first+nx[num],tmp.second+ny[num]));
        }
        else{
            ll p;
            cin >> p;
            PRINT(r[p-1].first << " " << r[p-1].second);
        }
    }
}

Submission Info

Submission Time
Task C - Loong Tracking
User karudano
Language C++ 20 (gcc 12.2)
Score 300
Code Size 3049 Byte
Status AC
Exec Time 270 ms
Memory 19772 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 64 ms 19656 KiB
random_02.txt AC 52 ms 4444 KiB
random_03.txt AC 55 ms 19660 KiB
random_04.txt AC 39 ms 12256 KiB
random_05.txt AC 169 ms 19604 KiB
random_06.txt AC 167 ms 17936 KiB
random_07.txt AC 68 ms 19676 KiB
random_08.txt AC 30 ms 7180 KiB
random_09.txt AC 270 ms 19592 KiB
random_10.txt AC 259 ms 8980 KiB
random_11.txt AC 108 ms 19600 KiB
random_12.txt AC 83 ms 8836 KiB
random_13.txt AC 139 ms 3540 KiB
random_14.txt AC 1 ms 3532 KiB
random_15.txt AC 62 ms 19624 KiB
random_16.txt AC 61 ms 19696 KiB
random_17.txt AC 59 ms 19772 KiB
random_18.txt AC 61 ms 19656 KiB
random_19.txt AC 160 ms 19648 KiB
random_20.txt AC 157 ms 19604 KiB
random_21.txt AC 148 ms 19580 KiB
random_22.txt AC 158 ms 19596 KiB
random_23.txt AC 253 ms 19644 KiB
random_24.txt AC 249 ms 19696 KiB
random_25.txt AC 232 ms 19720 KiB
random_26.txt AC 248 ms 19608 KiB
random_27.txt AC 157 ms 19600 KiB
random_28.txt AC 154 ms 19516 KiB
random_29.txt AC 145 ms 19604 KiB
random_30.txt AC 155 ms 19592 KiB
sample_01.txt AC 1 ms 3480 KiB