Submission #49075942


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll MOD=998244353;
// head

signed main() 
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n,q;cin>>n>>q;
	vector<pair<int,int>> V;
	for(int i=n;i>=1;i--) V.pb({i,0});
	int sz=n-1;
	while(q--)
	{
		int opt;cin>>opt;
		if(opt==1){
			char s;cin>>s;
			int x=V[sz].first,y=V[sz].second;
			if(s=='R') V.pb({x+1,y});
			else if(s=='L') V.pb({x-1,y});
			else if(s=='U') V.pb({x,y+1});
			else V.pb({x,y-1});
			sz++;
			//cout<<V[sz-1].first<<" "<<V[sz-1].second<<s<<V[sz].first<<" "<<V[sz].second<<endl;
		}
		else {
			int x;cin>>x;
			cout<<V[sz-x+1].first<<" "<<V[sz-x+1].second<<endl;
		}
	}
}

Submission Info

Submission Time
Task C - Loong Tracking
User gangbengr
Language C++ 20 (gcc 12.2)
Score 300
Code Size 941 Byte
Status AC
Exec Time 216 ms
Memory 36204 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 52 ms 36120 KiB
random_02.txt AC 34 ms 7344 KiB
random_03.txt AC 47 ms 36076 KiB
random_04.txt AC 30 ms 19576 KiB
random_05.txt AC 138 ms 36032 KiB
random_06.txt AC 131 ms 19552 KiB
random_07.txt AC 56 ms 19536 KiB
random_08.txt AC 24 ms 7224 KiB
random_09.txt AC 216 ms 19536 KiB
random_10.txt AC 208 ms 11488 KiB
random_11.txt AC 88 ms 19636 KiB
random_12.txt AC 67 ms 11392 KiB
random_13.txt AC 113 ms 5172 KiB
random_14.txt AC 1 ms 3424 KiB
random_15.txt AC 51 ms 36080 KiB
random_16.txt AC 51 ms 36116 KiB
random_17.txt AC 50 ms 36144 KiB
random_18.txt AC 52 ms 36140 KiB
random_19.txt AC 134 ms 36084 KiB
random_20.txt AC 133 ms 36132 KiB
random_21.txt AC 130 ms 36160 KiB
random_22.txt AC 134 ms 36032 KiB
random_23.txt AC 206 ms 19604 KiB
random_24.txt AC 205 ms 19540 KiB
random_25.txt AC 200 ms 19468 KiB
random_26.txt AC 206 ms 19712 KiB
random_27.txt AC 130 ms 36064 KiB
random_28.txt AC 130 ms 36204 KiB
random_29.txt AC 127 ms 36148 KiB
random_30.txt AC 130 ms 36060 KiB
sample_01.txt AC 1 ms 3428 KiB