Submission #3301228


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int n, cnt[2], x[1010], y[1010];

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d %d", &x[i], &y[i]);
        if ((x[i]&1) == (y[i]&1)) cnt[0]++;
        else cnt[1]++;
    }

    if (cnt[0] && cnt[1]) printf("-1\n");
    else if (cnt[0]) {
        printf("22\n");
        for (int i = 0; i < 22; i++) {
            if (i) printf(" ");
            printf("1");
        }
        printf("\n");

        for (int i = 0; i < n; i++) {
            string ans = "";
            int lft = 22;
            while (x[i] < 0) {
                ans += 'L';
                x[i]++;
                lft--;
            }
            while (x[i] > 0) {
                ans += 'R';
                x[i]--;
                lft--;
            }
            while (y[i] < 0) {
                ans += 'D';
                y[i]++;
                lft--;
            }
            while (y[i] > 0) {
                ans += 'U';
                y[i]--;
                lft--;
            }
            while (lft) {
                ans += "LR";
                lft -= 2;
            }
            cout << ans << endl;
        }
    }
    else {
        printf("21\n");
        for (int i = 0; i < 21; i++) {
            if (i) printf(" ");
            printf("1");
        }
        printf("\n");

        for (int i = 0; i < n; i++) {
            string ans = "";
            int lft = 21;
            while (x[i] < 0) {
                ans += 'L';
                x[i]++;
                lft--;
            }
            while (x[i] > 0) {
                ans += 'R';
                x[i]--;
                lft--;
            }
            while (y[i] < 0) {
                ans += 'D';
                y[i]++;
                lft--;
            }
            while (y[i] > 0) {
                ans += 'U';
                y[i]--;
                lft--;
            }
            while (lft) {
                ans += "LR";
                lft -= 2;
            }
            cout << ans << endl;
        }
    }

    return 0;
}

Submission Info

Submission Time
Task D - Robot Arms
User arthurCF
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2191 Byte
Status
Exec Time 2105 ms
Memory 1051012 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
./Main.cpp:11:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x[i], &y[i]);
                                     ^

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 2105 ms 1049860 KB
10.txt 2 ms 256 KB
11.txt 2105 ms 1050884 KB
12.txt 2 ms 256 KB
13.txt 2105 ms 1049476 KB
14.txt 2105 ms 1050116 KB
15.txt 2105 ms 1049348 KB
16.txt 2105 ms 1050500 KB
17.txt 2 ms 256 KB
18.txt 2105 ms 1049860 KB
19.txt 2105 ms 1049476 KB
2.txt 1 ms 256 KB
20.txt 2105 ms 1050756 KB
21.txt 2 ms 256 KB
22.txt 2 ms 256 KB
23.txt 2105 ms 1050628 KB
24.txt 2105 ms 1049860 KB
25.txt 2105 ms 1050372 KB
26.txt 2105 ms 1049476 KB
27.txt 2 ms 256 KB
28.txt 2105 ms 1049988 KB
29.txt 2105 ms 1051012 KB
3.txt 2105 ms 1050116 KB
30.txt 2105 ms 1050884 KB
31.txt 2105 ms 1050244 KB
32.txt 2105 ms 524932 KB
33.txt 2105 ms 1048964 KB
34.txt 2105 ms 1049988 KB
4.txt 2105 ms 1050116 KB
5.txt 2105 ms 1050756 KB
6.txt 2105 ms 1050628 KB
7.txt 2 ms 256 KB
8.txt 2105 ms 524932 KB
9.txt 2105 ms 1050500 KB
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 2 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