QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54482#3308. Remote ControlAllenKING_REDAC ✓335ms33968kbC++2.1kb2022-10-08 21:49:252022-10-08 21:49:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-08 21:49:27]
  • 评测
  • 测评结果:AC
  • 用时:335ms
  • 内存:33968kb
  • [2022-10-08 21:49:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
int n,Q;
int nowx,nowy;
map<pair<int,int>,int>q;
string s;
struct mem{
	int x;
	int y;
}a[N],b[N];
int fa[N];
int find(int x)
{
	if(fa[x]==x)return x;
	return fa[x]=find(fa[x]);
}
int main(void)
{
	cin>>n;
	cin>>s;
	cin>>Q;
	for(int i=1;i<=Q;i++)
	{
		scanf("%d%d",&a[i].x,&a[i].y);
		b[i].x=a[i].x;
		b[i].y=a[i].y;
		fa[i]=i;
		if(!q[make_pair(a[i].x,a[i].y)])
			q[make_pair(a[i].x,a[i].y)]=i;
		else
			fa[i]=q[make_pair(a[i].x,a[i].y)];
	}
	for(int i=0;i<n;i++)
	{
		if(s[i]=='R')
			nowx--;
		else if(s[i]=='L')
			nowx++;
		else if(s[i]=='D')
			nowy++;
		else if(s[i]=='U')
			nowy--;
		if(q[make_pair(nowx,nowy)])
		{
			int num=q[make_pair(nowx,nowy)];
			if(s[i]=='R')
			{
				b[num].x--;
				if(!q[make_pair(nowx-1,nowy)])
				{
					q[make_pair(nowx-1,nowy)]=q[make_pair(nowx,nowy)];
					q[make_pair(nowx,nowy)]=0;
				}
				else
				{
					fa[find(num)]=find(q[make_pair(nowx-1,nowy)]);
					q[make_pair(nowx,nowy)]=0;
				}
			}
			else if(s[i]=='L')
			{
				b[num].x++;
				if(!q[make_pair(nowx+1,nowy)])
				{
					q[make_pair(nowx+1,nowy)]=q[make_pair(nowx,nowy)];
					q[make_pair(nowx,nowy)]=0;
				}
				else
				{
					fa[find(num)]=find(q[make_pair(nowx+1,nowy)]);
					q[make_pair(nowx,nowy)]=0;
				}				
			}
			else if(s[i]=='D')
			{
				b[num].y++;
				if(!q[make_pair(nowx,nowy+1)])
				{
					q[make_pair(nowx,nowy+1)]=q[make_pair(nowx,nowy)];
					q[make_pair(nowx,nowy)]=0;
				}
				else
				{
					fa[find(num)]=find(q[make_pair(nowx,nowy+1)]);
					q[make_pair(nowx,nowy)]=0;
				}						
			}
			else if(s[i]=='U')
			{
				b[num].y--;
				if(!q[make_pair(nowx,nowy-1)])
				{
					q[make_pair(nowx,nowy-1)]=q[make_pair(nowx,nowy)];
					q[make_pair(nowx,nowy)]=0;
				}
				else
				{
					fa[find(num)]=find(q[make_pair(nowx,nowy-1)]);
					q[make_pair(nowx,nowy)]=0;
				}					
			}
		}
	}
	for(int i=1;i<=Q;i++)
	{
		int nxt=find(i);
		int x=0,y=0;
		x=-(nowx-b[nxt].x);
		y=-(nowy-b[nxt].y);
		printf("%d %d\n",x,y);
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3792kb

input:

8
RRDRUULL
5
-2 1
-2 2
-2 -1
-3 -1
1 1

output:

-1 3
-1 3
1 0
-2 -1
2 2

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 3832kb

input:

8
LLDDRRUU
18
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3

output:

1 1
-1 2
1 3
2 3
2 3
2 3
3 1
3 2
3 3
1 1
-1 2
1 3
2 3
2 3
2 3
3 1
3 2
3 3

result:

ok 18 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 3832kb

input:

1000
ULRULRURDDDLURUURULUDRDDRDLURRRUDDDDDURURUDDDRLLDURDDDLLDLULUURDRRDDDURDDRLRULDLUULDLRDLURUUUUDDRULDRRUDDDDUUULLURDUUUULDLDDUUUDUUUUDDLURLUDDDUDLDLRRUDURDRDLRURLUULDRLRDRDDRDRRDLUUURURLRLDUDLDLRURLURUDRRULDRDDRUDDDRURDRRDLDLRDLRDUDDLLLLRUULRRUDURUUUDDDLRDRDRDRURUDDURUDLRLDLLDDULURDURDLLLUULLDLD...

output:

-105 -4
17 -30
41 80
6 -100
23 28
10 -58
-22 -34
1 24
-46 -79
-43 87
-102 -76
85 25
-42 -3
-71 36
-55 -109
-39 -105
5 -102
82 15
42 -22
81 63
-64 -7
-82 -62
74 9
-41 37
21 18
-109 -38
51 48
10 -46
-37 28
-18 -110
-67 -74
-96 -55
-5 16
-49 -21
-81 -56
-106 27
62 48
21 59
-79 72
4 29
17 -65
87 44
72 1...

result:

ok 1000 lines

Test #4:

score: 0
Accepted
time: 289ms
memory: 33968kb

input:

300000
DDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURULDDLURU...

output:

1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1 -1
1 1
1 -1
1...

result:

ok 300000 lines

Test #5:

score: 0
Accepted
time: 320ms
memory: 29008kb

input:

200000
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU...

output:

0 -1
0 -1
0 -1
0 -1
0 -99641
0 -1
0 -1
0 -26077
0 -84323
0 -1
0 -1
0 -1
0 -1
0 -1
0 -52103
0 -1
0 -36581
205447 364884
0 -1
0 -12052
0 -22844
0 -1
0 -1
0 -1
-164302 -26107
0 -8670
0 -39346
0 -33207
0 -1
-177189 -95427
0 -1
0 -5158
0 -1
0 -1
0 -74688
0 -1
0 -28631
0 -1
0 -1
0 -1
0 -1
0 -1
0 -63110
0 ...

result:

ok 300000 lines

Test #6:

score: 0
Accepted
time: 298ms
memory: 28380kb

input:

200000
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

output:

0 33810
0 1
0 1
0 1
0 4542
0 1
18257 -426088
0 1
0 1
0 41965
0 38847
0 74819
-95683 -461933
0 1
0 1
-246860 -426475
0 1
0 1
0 1
0 18746
0 1
0 1
0 20401
0 1
0 1
0 1
0 1
0 12685
0 1
0 1
0 1
-116830 -258364
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 2120
0 1
214262 -444677
0 1
0 12012
0 1
0 74965
0 1
0 1
0 1
0 1
0 ...

result:

ok 300000 lines

Test #7:

score: 0
Accepted
time: 300ms
memory: 28720kb

input:

200000
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

1 0
1 0
6255 0
80569 0
76020 0
63049 0
1 0
1 0
1 0
1 0
1 0
40487 0
1 0
-51749 -236067
55107 0
1 0
1 0
1 0
-408704 44082
75153 0
1 0
1 0
1 0
10026 0
6101 0
64779 0
90932 0
60036 0
1 0
1 0
97986 0
1 0
55850 0
1 0
1 0
82095 0
1 0
95436 0
1 0
1 0
1 0
15016 0
48526 0
97466 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
-...

result:

ok 300000 lines

Test #8:

score: 0
Accepted
time: 335ms
memory: 28192kb

input:

200000
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:

-1 0
-10380 0
-1 0
-1 0
-87094 0
144065 69971
-48816 0
-70459 0
-1 0
-1 0
-1 0
-32060 0
-1 0
-1 0
-1 0
26609 -215464
-1 0
-1 0
-32043 0
-1 0
-1 0
109198 221466
-1 0
-81134 0
-1 0
-1009 0
-74717 0
-1 0
-1 0
186529 -114263
-93456 0
-1 0
373651 211860
-39834 0
-1 0
-1 0
-56783 0
-1 0
-1 0
-1 0
-1 0
-82...

result:

ok 300000 lines

Test #9:

score: 0
Accepted
time: 123ms
memory: 11768kb

input:

300000
LDLUUUDRRLRLLRRDRRLDDUUUDLULDRUDURRLUDDLLRLDLLRLUDUDUDUURRDRULDUUULULLLUUDUDRLLURLULDRRDUDRDDDDULLRRLRLRRRUURDLDDULRDUUDRRURUDLURDLLDDDDDDLULDDRURRURLULULRDDDLUDRUDLRDULULULDLDLDLDRUDURUDRDDUULLUUDDUUURUDDDDULURLDLDDDRULRDDDDDLURUDRDLDDLLRLURLULDRRDLLURLRDRURRRLURUDULDRRDDLULDUUDRLRRDRULRRDRU...

output:

-176 150
-179 142
-169 152
-179 142
-179 142
-179 142
-165 143
-165 139
-163 151
-162 140
-176 152
-172 141
-174 140
-169 152
-179 142
-175 151
-161 142
-161 153
-166 140
-163 151
-164 147
-178 138
-175 152
-164 142
-162 143
-172 141
-162 143
-173 135
-165 160
-176 150
-165 160
-178 138
-172 141
-16...

result:

ok 300000 lines

Test #10:

score: 0
Accepted
time: 213ms
memory: 13172kb

input:

300000
RLRLDRRRDRDURDRULUDLLDLRRLLRDDDURDLDUDDDULLLULULLURDLDLDULLURUULRLRUULULDDULLLLRRRLRRURDDLLULDDLDRDLDRULRLRLLDDRDDRDDLLDUDUULLRLURURURDLLRUDRULRDRDLUULDURRLURLDULUUULUDRRLRDLUDLUULUURRDDRURLRRDULUDUURDLDDURRRUUUDLUDDRLDDRDUDULDRRLDDUUDLDRRDRRDUDUDLRLULURRLURDDRLRDULLLRRDDUDULDLLLUDUDRUULDRRLU...

output:

-35 60
-31 35
-56 29
54 88
-7 139
63 121
-47 39
75 113
46 76
13 56
-49 -12
-27 78
-74 -39
50 91
15 87
71 -10
-79 103
-99 42
-102 -41
-72 24
71 -21
-82 72
-21 73
-92 92
-39 136
-63 12
68 90
65 69
60 113
36 89
-21 -26
26 -41
50 62
74 67
57 117
-66 -37
-79 36
-80 88
-78 -47
77 65
-98 130
-94 43
-9 48
-...

result:

ok 299999 lines

Test #11:

score: 0
Accepted
time: 323ms
memory: 29824kb

input:

299999
DLDULDRRRULLURDRULRRLLLDULURURDULDLDRUDULRLULURRDLLRULLDURDDLLDUULLULDLULDLDUULLRDUDLULRULRUULLDLLRDUUUDLDLRLDDRDDUDUULUURDLRDRLURDURDRDLRLUDDDLRURRRRLRULULDLDULRLLDDDRLURUUUURDDLULURUDURDDLRDDDULDRURRLRDRUURUULRDRURDUDDURURULLUURRDURDDRRUDRLLUDUDDLLDURRRDRUUUUDLLDRLRLUUDLDRUURLUULUDRDDULDRRR...

output:

-93 -237
-421 -720
-1149 615
323 -210
466 761
639 -451
447 -275
-812 1097
-44 150
-619 861
769 1097
-118 1003
-272 367
141 -179
47 412
-986 -503
175 739
661 -656
-1132 -745
-1158 -769
232 -830
82 345
-32 -821
-1039 641
74 1062
437 980
-518 931
-763 -74
301 21
710 -657
-6 -156
282 -288
-151 910
-767 ...

result:

ok 300000 lines

Test #12:

score: 0
Accepted
time: 315ms
memory: 30588kb

input:

300000
LDULRDDRLUULULDDRDUURDDLULDRDDRUURULULURLDLRUUUUDLDLRLDURRULDURDDULLRRURURRURUDRDUUDDRRLDDLDLRLLULLRUURRDDDLURDRRLDRDDRDURLDLRLULUURULUUURLRRRLLUUULURDULDUDDRDLDLDULUUDDDDDURLLLRLDDDDRRRUDDRLURDUDLLDLUURUURURRDLDURULDLLDURDLRUDRUUDULRRLLRDRLUUULDDLLDRLDRRDDRUUDRRDLLUDLUUUURDULUULDULRUURULLLLU...

output:

-2290 -3354
-379 3430
-2727 4841
6812 -7278
-4709 -647
-9380 1734
-3092 -5840
-5755 151
-9814 -255
5303 8311
1149 -7245
-622 -933
415 -8122
2688 4529
-4953 -3282
-649 1468
-6471 -854
-7751 3014
8595 3175
-2709 -7590
719 -7273
-9418 5043
-1415 -3180
-2528 110
5041 7137
-5921 8855
4505 3523
-3390 7641...

result:

ok 299990 lines

Test #13:

score: 0
Accepted
time: 327ms
memory: 29984kb

input:

299998
UDRDLDDURULRUUUURDULDRRLURUDLLUUUUULULLLUDDRUDDLULRRRLRUDDDULURLLRLRRRDUDUDLDURRLLDURUUDULRRUDRRUDLURRDUURLUURLUDLRURLRLRRRURDDRULRRULLUUDUDRDLUDDRRDRRDULUDUDULDRDLRUUULLRLULURRRRDDRUULDLLDUDDRLDURLULURUDRLRDLULRDLLLDRLDULLRRDLDURDUURLDLLRLLDDURUDRDDLUURDURRULRRRDDLLRRDURRDDULLLURDULLUDULDRLL...

output:

-29462 63974
-7143 21433
-83063 -63984
66627 -29319
-18146 11845
-59252 17775
53907 80630
-81579 -81141
13175 -66407
-89811 -83818
34870 -96523
-5970 23702
63959 -30366
-73315 24745
-38649 79448
-47268 -66619
44129 71303
7769 87812
-30544 -64444
-32104 77017
35367 77935
75650 -86168
-87240 -68450
-2...

result:

ok 299999 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

10
DRLLRUURLR
10
-1 0
0 1
-1 0
-1 -1
-1 -1
-1 0
-1 0
0 1
-1 1
-1 1

output:

0 1
1 3
0 1
-1 0
-1 0
0 1
0 1
1 3
-1 2
-1 2

result:

ok 10 lines

Test #15:

score: 0
Accepted
time: 126ms
memory: 9688kb

input:

300000
LDLUUUDRRLRLLRRDRRLDDUUUDLULDRUDURRLUDDLLRLDLLRLUDUDUDUURRDRULDUUULULLLUUDUDRLLURLULDRRDUDRDDDDULLRRLRLRRRUURDLDDULRDUUDRRURUDLURDLLDDDDDDLULDDRURRURLULULRDDDLUDRUDLRDULULULDLDLDLDRUDURUDRDDUULLUUDDUUURUDDDDULURLDLDDDRULRDDDDDLURUDRDLLLRLURLULDRRDLLURLRDRURRRLURUDULDRRDDLULDUUDRLRRDRULRRDRUDL...

output:

0 4
-6 -18
-10 -5
-2 4
-6 4
-2 4
-10 -5
10 4
12 -16
-10 -5
-2 4
12 -10
-6 -18
12 -4
11 4
-2 4
-2 4
-4 -18
-4 -18
-1 4
-6 -18
2 -18
3 -18
-10 -4
-2 4
12 -13
0 4
-10 -5
12 -5
9 4
9 -18
-2 4
5 -18
-10 -6
-2 4
-6 4
0 4
-6 -18
0 4
-10 -8
-6 -18
11 4
-2 4
-2 4
5 -18
-1 4
7 4
2 -18
-10 -6
-2 4
12 -10
-2 4
...

result:

ok 300000 lines

Test #16:

score: 0
Accepted
time: 191ms
memory: 12212kb

input:

300000
UUURLRULURDRURDDULDRRURRRUUUDDLDDDRUDRUURRRRUDLULDLRRLDURLUULUDURLRRLRDDRLLLDDURUUULURUDURLRRLLLLLULULRDDDRDUDUDUDUURUDDLUDDLRUURLLURURUURURRUURLLDLLRRULUDRLUUDDUDLUDRRUDRUULLRULRRULLLLRLRURUDULLLLLDDDDRULULRULLRLDRUUDDRLRLDURULDLULUDUUDULLDURRDLDDRLDRLDDRLRRDDDDRUURRLUUURLDDLRUDURLDRLLDURURL...

output:

-86 175
-24 -12
67 15
57 0
-74 35
-25 146
-26 14
-5 127
-125 143
-51 82
-61 23
-18 32
14 45
-125 -6
-33 125
22 16
-88 175
11 93
-20 134
3 16
59 149
-123 11
-27 3
-45 126
-62 25
-15 136
-42 12
26 -6
-113 189
-4 18
36 124
-108 147
-62 -4
59 6
-71 -4
-104 79
-25 164
43 107
30 75
-77 147
65 149
29 161
-...

result:

ok 300000 lines

Test #17:

score: 0
Accepted
time: 330ms
memory: 29820kb

input:

300000
DUDRUDLDRUDRDDURURULDDLRDULDURRULUDRDRLDDLLUURRDLULLLUURLUDURRUDUDLRLULULLULRDLUURUURLLUUDDLRDLUDLLUURRUUDDRLULRDURDULDULDULLLRDUURRDURRLLRLLLLRUULULURLURUULUDDLUUDRRUUDDDULLLLLLDDUDRLRRUDLLRRURDDDDLURLRRLULRDLUULULDLLDULDLRRULURDRDLLLDRURLUUUDDDDLDRDDRLDDLUUULRDDDUULRRRRRURDRUDDULLUULRLLDLRD...

output:

-70 639
-20 903
788 -771
82 -214
998 -446
-796 732
926 -597
-299 809
594 404
532 -60
747 -813
-734 430
278 938
526 -743
817 -198
-594 783
867 39
-641 -665
516 528
1095 694
-275 62
-95 430
725 589
346 586
5 966
22 -386
15 -799
776 616
840 405
-469 6
45 20
647 453
-431 954
679 747
-150 830
-540 1091
-...

result:

ok 300000 lines

Test #18:

score: 0
Accepted
time: 2ms
memory: 3728kb

input:

1
R
1
-1 0

output:

-1 0

result:

ok single line: '-1 0'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

1
R
1
-1 1

output:

0 1

result:

ok single line: '0 1'

Test #20:

score: 0
Accepted
time: 291ms
memory: 30004kb

input:

300000
RLDDUUULULLLDLUUULDUUUULUUUDLDRDDURDURULURULLLDLRLRDLDULDRLLDRUUDLDRRLRRUDDURRLLDUURRRLURURDRRUUDLDLLRDLLULRLLLLLLURURURRLRUUUUDURDLULLDUUDUDDDDRLURRUDULDLDDLLURLDRLDRLDLUDRLUURRRDLLDDDDDUULUUUDRLLLRDLDRUUUDULDDUDDDURRRRRLLDDLDLLULULDUUDULLDDLDLLRUDDUULULUDULRDRUDDRDLDULDRDRRRUDLDDULRULRDULDR...

output:

-9332 8824
-9068 3493
-6319 1446
8422 7273
7121 5794
6452 9853
2163 -1542
-6115 6088
-3420 -2024
-2180 3951
2774 4058
-789 -542
-4106 -346
-3593 -9927
9631 4255
7595 2087
-3927 -4949
-6053 -649
4258 3076
-1109 7057
-9778 1984
-8549 4775
-3576 9839
-8587 -3366
2359 1443
2620 -1050
-4687 -5952
8309 31...

result:

ok 300000 lines

Test #21:

score: 0
Accepted
time: 306ms
memory: 30516kb

input:

300000
UULDRULLRRUUDDLRRDURDLURDDLDRDUUDULUDRRDLLRULDRDRUURDUDRLRULLDDLRDRDLUDLDRLLRUDURDDDDULDRURUDLRRDDUUDRLDULDLUDLLRULLDLULURLLULULUUDLRDURRUUULUULRDUDLRLUDRLDUULRLURLDDLRRURDRDLUUDDLLLUDRRDRUDULDRUUURUDRRRRDDDDDRRDRRLDDUDRUURUUULDRRRDRRRDRLRULRDRDRDLRUDDUDDURRUURLDRRLRULLLDUDURLUULLLLDDUULRDRDL...

output:

64486 210991
18829 -106476
214874 -91865
-149817 -53298
-2024 -171848
-15238 -13237
-105300 -259208
-51315 90221
-275527 289988
-56061 180666
268267 281262
3407 -97832
-110072 249530
-140676 -103457
-246837 19673
194319 -169313
120225 -9828
156311 -127514
94699 215945
59276 -58088
180920 145130
-286...

result:

ok 300000 lines