Submission #3294316

Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int main(){
    int i, j, k;
    int N, X[1000], Y[1000], S[1000];
    cin >> N;
    for(i=0; i<N; i++){
        cin >> X[i] >> Y[i];
        S[i] = X[i] + Y[i];
        if((S[i] - S[0]) % 2 != 0){
            cout << -1 << endl;
            return 0;
        }
    }
    int M = 20 + abs(S[0] % 2);
    cout << M << endl;
    for(i=0; i<M; i++) cout << 1 << " \n"[i==M-1];
    for(i=0; i<N; i++){
        int l = max(0, -X[i]), r = max(0, X[i]);
        int d = max(0, -Y[i]), u = max(0, Y[i]);
        int rem = M - (l+r+d+u);
        d += rem/2; u += rem/2;
        for(j=0; j<l; j++) cout << "L";
        for(j=0; j<r; j++) cout << "R";
        for(j=0; j<u; j++) cout << "U";
        for(j=0; j<d; j++) cout << "D";
        cout << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task D - Robot Arms
User betrue12
Language C++14 (GCC 5.4.1)
Score 300
Code Size 841 Byte
Status

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
10.txt 1 ms 256 KB
11.txt
12.txt 1 ms 256 KB
13.txt
14.txt
15.txt
16.txt
17.txt 1 ms 256 KB
18.txt
19.txt
2.txt 1 ms 256 KB
20.txt
21.txt 1 ms 256 KB
22.txt 1 ms 256 KB
23.txt
24.txt
25.txt
26.txt
27.txt 1 ms 256 KB
28.txt
29.txt
3.txt
30.txt
31.txt
32.txt
33.txt
34.txt
4.txt
5.txt
6.txt
7.txt 1 ms 256 KB
8.txt
9.txt
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB
sample3.txt 1 ms 256 KB
sample4.txt 1 ms 256 KB
sub1.txt 2 ms 256 KB
sub10.txt 1 ms 256 KB
sub11.txt 4 ms 256 KB
sub12.txt 1 ms 256 KB
sub13.txt 4 ms 256 KB
sub14.txt 4 ms 256 KB
sub15.txt 4 ms 256 KB
sub16.txt 4 ms 256 KB
sub2.txt 1 ms 256 KB
sub3.txt 4 ms 256 KB
sub4.txt 4 ms 256 KB
sub5.txt 4 ms 256 KB
sub6.txt 4 ms 256 KB
sub7.txt 1 ms 256 KB
sub8.txt 4 ms 256 KB
sub9.txt 4 ms 256 KB