Submission #3305898

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;
        }
    }

    vector<int> values;
    for(i=30; i>=0; i--) values.push_back(1<<i);
    if(S[0] % 2 == 0) values.push_back(1);
    int M = values.size();
    cout << M << endl;
    for(i=0; i<M; i++) cout << values[i] << " \n"[i==M-1];

    for(i=0; i<N; i++){
        int xpy = X[i] + Y[i], xmy = X[i] - Y[i];
        for(auto&& v : values){
            if(xpy >= 0){
                if(xmy >= 0){
                    cout << "R";
                    xpy -= v;
                    xmy -= v;
                }else{
                    cout << "U";
                    xpy -= v;
                    xmy += v;
                }
            }else{
                if(xmy >= 0){
                    cout << "D";
                    xpy += v;
                    xmy -= v;
                }else{
                    cout << "L";
                    xpy += v;
                    xmy += v;
                }
            }
        }
        cout << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task D - Robot Arms
User betrue12
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1325 Byte
Status
Exec Time 5 ms
Memory 256 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 300 / 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 2 ms 256 KB
10.txt 1 ms 256 KB
11.txt 5 ms 256 KB
12.txt 1 ms 256 KB
13.txt 5 ms 256 KB
14.txt 5 ms 256 KB
15.txt 4 ms 256 KB
16.txt 5 ms 256 KB
17.txt 1 ms 256 KB
18.txt 5 ms 256 KB
19.txt 5 ms 256 KB
2.txt 1 ms 256 KB
20.txt 4 ms 256 KB
21.txt 1 ms 256 KB
22.txt 1 ms 256 KB
23.txt 4 ms 256 KB
24.txt 5 ms 256 KB
25.txt 5 ms 256 KB
26.txt 5 ms 256 KB
27.txt 1 ms 256 KB
28.txt 5 ms 256 KB
29.txt 4 ms 256 KB
3.txt 4 ms 256 KB
30.txt 4 ms 256 KB
31.txt 5 ms 256 KB
32.txt 5 ms 256 KB
33.txt 5 ms 256 KB
34.txt 5 ms 256 KB
4.txt 5 ms 256 KB
5.txt 5 ms 256 KB
6.txt 5 ms 256 KB
7.txt 1 ms 256 KB
8.txt 5 ms 256 KB
9.txt 5 ms 256 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 1 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