Submission #3297534


Source Code Expand

Copy
n=int(input())
x=[]
y=[]
md=[]
odd=0
even=0

over10=0
for i in range(n):
    X,Y=map(int,input().split())
    x.append(X)
    y.append(Y)
    mdx=abs(X)+abs(Y)
    md.append(mdx)
    if(mdx>20):over10=1
    if(mdx%2==0):even+=1
    else:odd+=1

    
if(over10):
    print(1)
    print(1)
    for i in range(n):print("L")
    exit()
    
    
if(odd!=0 and even!=0):print(-1)
else:
    if(odd!=0):
        m=max(md)
        print(m)
        d=[1 for _ in range(m)]
        print(*d)
        #print(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
    else:
        m=max(md)
        print(m)
        d=[1 for _ in range(m)]
        print(*d)
        #print(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
    for i in range(n):
        outp=""
        pl=0
        if(x[i]<0):pl="L"
        else:pl="R"
        for _ in range(abs(x[i])):outp+=pl
        if(y[i]<0):pl="D"
        else:pl="U"
        for _ in range(abs(y[i])):outp+=pl
        rem=m-abs(x[i])-abs(y[i])
        for j in range(rem):
            if(j%2==0):outp+="R"
            else:outp+="L"
        print(outp)

Submission Info

Submission Time
Task D - Robot Arms
User shomu36
Language Python3 (3.4.3)
Score 300
Code Size 1112 Byte
Status
Exec Time 27 ms
Memory 3316 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt, sample4.txt
subtask 300 / 300 sample1.txt, sample2.txt, sample3.txt, sample4.txt, sub1.txt, sub10.txt, sub11.txt, sub12.txt, sub13.txt, sub14.txt, sub15.txt, sub16.txt, sub2.txt, sub3.txt, sub4.txt, sub5.txt, sub6.txt, sub7.txt, sub8.txt, sub9.txt
All 0 / 300 sample1.txt, sample2.txt, sample3.txt, sample4.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt, sub1.txt, sub10.txt, sub11.txt, sub12.txt, sub13.txt, sub14.txt, sub15.txt, sub16.txt, sub2.txt, sub3.txt, sub4.txt, sub5.txt, sub6.txt, sub7.txt, sub8.txt, sub9.txt
Case Name Status Exec Time Memory
1.txt 18 ms 3064 KB
10.txt 22 ms 3316 KB
11.txt 22 ms 3316 KB
12.txt 22 ms 3316 KB
13.txt 22 ms 3316 KB
14.txt 22 ms 3316 KB
15.txt 22 ms 3316 KB
16.txt 21 ms 3316 KB
17.txt 21 ms 3316 KB
18.txt 22 ms 3316 KB
19.txt 22 ms 3316 KB
2.txt 18 ms 3188 KB
20.txt 22 ms 3316 KB
21.txt 22 ms 3316 KB
22.txt 22 ms 3316 KB
23.txt 22 ms 3316 KB
24.txt 22 ms 3316 KB
25.txt 21 ms 3316 KB
26.txt 22 ms 3316 KB
27.txt 21 ms 3316 KB
28.txt 22 ms 3316 KB
29.txt 21 ms 3316 KB
3.txt 21 ms 3316 KB
30.txt 21 ms 3316 KB
31.txt 22 ms 3316 KB
32.txt 22 ms 3316 KB
33.txt 22 ms 3316 KB
34.txt 22 ms 3316 KB
4.txt 21 ms 3316 KB
5.txt 22 ms 3316 KB
6.txt 22 ms 3316 KB
7.txt 22 ms 3316 KB
8.txt 22 ms 3316 KB
9.txt 22 ms 3316 KB
sample1.txt 17 ms 3064 KB
sample2.txt 18 ms 3064 KB
sample3.txt 17 ms 3188 KB
sample4.txt 17 ms 3064 KB
sub1.txt 18 ms 3064 KB
sub10.txt 21 ms 3188 KB
sub11.txt 27 ms 3188 KB
sub12.txt 21 ms 3188 KB
sub13.txt 27 ms 3188 KB
sub14.txt 26 ms 3188 KB
sub15.txt 26 ms 3188 KB
sub16.txt 27 ms 3188 KB
sub2.txt 20 ms 3188 KB
sub3.txt 26 ms 3188 KB
sub4.txt 27 ms 3188 KB
sub5.txt 27 ms 3188 KB
sub6.txt 26 ms 3188 KB
sub7.txt 21 ms 3188 KB
sub8.txt 27 ms 3188 KB
sub9.txt 27 ms 3188 KB