Submission #3818511


Source Code Expand

//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n,x,y,l;
vpi pos;
vi lens,d;
map<int,int> tempd;

const char vec[4] = {'L', 'D', 'U', 'R'};
signed main(){
    I(n);
    REP(i,n){
        I(x); I(y);
        pos.eb(x,y);
        lens.pb(abs(x) + abs(y));
        if (i && lens[i]%2 != lens[i-1]%2 ){
            cout << -1 << endl;
            return 0;
        }
    }
    int ld = 33;
    
    // REP(i,ld) d.pb(1LL << i);
    // if (lens[0]%2 == 0) d.pb(1);
    printf("%lld\n",ld + (lens[0]%2==0));
    REP(i,ld) printf("%lld ", 1LL<<i);
    if (lens[0]%2 == 0) printf("1");
    printf("\n");

    int dsum = (1LL << ld) - 1;


    for (auto p: pos){
        int px = p.first;
        int py = p.second - 1 + (lens[0]%2);
        
        int u = px + py;
        int v = px - py;
        int du = (u+dsum)/2;
        int dv = (v+dsum)/2;

        REP(i,ld){
            int mask = 1LL << i;
            printf("%c", vec[((mask&du)>0) * 2 + ((mask&dv)>0)]);
        }
        if (lens[0]%2 == 0) printf("U");
        printf("\n");

    }
}

Submission Info

Submission Time
Task D - Robot Arms
User omi
Language C++14 (GCC 5.4.1)
Score 600
Code Size 2353 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:51:9: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     I(n);
         ^
./Main.cpp:53:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         I(x); I(y);
             ^
./Main.cpp:53:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         I(x); I(y);
                   ^

Judge Result

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