Submission #3883351
Source Code Expand
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
#define mp make_pair
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
typedef unsigned int uint;
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
const int MX = 1<<19;
const int MM = 998244353;
pii D[MX];
int main()
{
int N;
scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d%d", &D[i].first, &D[i].second);
for(int i = 1; i <= N; i++){
if((D[i].first + D[i].second + D[1].first + D[1].second) % 2 != 0) return !printf("-1\n");
}
int ch = 0;
if((D[1].first + D[1].second) % 2 == 0) ch = 1;
if(ch) printf("32\n1 ");
else printf("31\n");
for(int i = 30; i >= 0; i--) printf("%d ", 1<<i);
printf("\n");
for(int i = 1; i <= N; i++){
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
char s[5] = "LDRU";
pii cur = pii(0, 0);
if(ch) printf("R"), cur = pii(1, 0);
for(int m = 30; m >= 0; m--){
ll dist = 1e18;
char ans;
pii x;
for(int d = 0; d < 4; d++){
pii nxt = pii(cur.first + dx[d] * (1<<m), cur.second + dy[d] * (1<<m));
ll t = abs(nxt.first - D[i].first) + abs(nxt.second - D[i].second);
if(dist > t) dist = t, ans = s[d], x = nxt;
}
cur = x; printf("%c", ans);
}
printf("\n");
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Robot Arms |
| User | zigui |
| Language | C++14 (GCC 5.4.1) |
| Score | 300 |
| Code Size | 2307 Byte |
| Status | WA |
| Exec Time | 2 ms |
| Memory | 256 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:62:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
./Main.cpp:63:70: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i = 1; i <= N; i++) scanf("%d%d", &D[i].first, &D[i].second);
^
Judge Result
| Set Name | Sample | subtask | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | 0 / 300 | ||||||||
| Status |
|
|
|
| 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 | WA | 1 ms | 256 KiB |
| 10.txt | AC | 1 ms | 256 KiB |
| 11.txt | WA | 2 ms | 256 KiB |
| 12.txt | AC | 1 ms | 256 KiB |
| 13.txt | WA | 2 ms | 256 KiB |
| 14.txt | WA | 2 ms | 256 KiB |
| 15.txt | WA | 2 ms | 256 KiB |
| 16.txt | WA | 2 ms | 256 KiB |
| 17.txt | AC | 1 ms | 256 KiB |
| 18.txt | WA | 2 ms | 256 KiB |
| 19.txt | WA | 2 ms | 256 KiB |
| 2.txt | AC | 1 ms | 256 KiB |
| 20.txt | WA | 2 ms | 256 KiB |
| 21.txt | AC | 1 ms | 256 KiB |
| 22.txt | AC | 1 ms | 256 KiB |
| 23.txt | WA | 2 ms | 256 KiB |
| 24.txt | WA | 2 ms | 256 KiB |
| 25.txt | WA | 2 ms | 256 KiB |
| 26.txt | WA | 2 ms | 256 KiB |
| 27.txt | AC | 1 ms | 256 KiB |
| 28.txt | WA | 2 ms | 256 KiB |
| 29.txt | WA | 2 ms | 256 KiB |
| 3.txt | WA | 2 ms | 256 KiB |
| 30.txt | WA | 2 ms | 256 KiB |
| 31.txt | WA | 2 ms | 256 KiB |
| 32.txt | WA | 2 ms | 256 KiB |
| 33.txt | WA | 2 ms | 256 KiB |
| 34.txt | WA | 2 ms | 256 KiB |
| 4.txt | WA | 2 ms | 256 KiB |
| 5.txt | WA | 2 ms | 256 KiB |
| 6.txt | WA | 2 ms | 256 KiB |
| 7.txt | AC | 1 ms | 256 KiB |
| 8.txt | WA | 2 ms | 256 KiB |
| 9.txt | WA | 2 ms | 256 KiB |
| sample1.txt | AC | 1 ms | 256 KiB |
| sample2.txt | AC | 1 ms | 256 KiB |
| sample3.txt | AC | 1 ms | 256 KiB |
| sample4.txt | AC | 1 ms | 256 KiB |
| sub1.txt | AC | 1 ms | 256 KiB |
| sub10.txt | AC | 1 ms | 256 KiB |
| sub11.txt | AC | 2 ms | 256 KiB |
| sub12.txt | AC | 1 ms | 256 KiB |
| sub13.txt | AC | 2 ms | 256 KiB |
| sub14.txt | AC | 2 ms | 256 KiB |
| sub15.txt | AC | 2 ms | 256 KiB |
| sub16.txt | AC | 2 ms | 256 KiB |
| sub2.txt | AC | 1 ms | 256 KiB |
| sub3.txt | AC | 2 ms | 256 KiB |
| sub4.txt | AC | 2 ms | 256 KiB |
| sub5.txt | AC | 2 ms | 256 KiB |
| sub6.txt | AC | 2 ms | 256 KiB |
| sub7.txt | AC | 1 ms | 256 KiB |
| sub8.txt | AC | 2 ms | 256 KiB |
| sub9.txt | AC | 2 ms | 256 KiB |