Submission #1985711
Source Code Expand
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int descending_compare(const void *a, const void *b){ if (*(int*)a > *(int*)b){ return -1; }else if (*(int*)a == *(int*)b){ return 0; }else{ return 1; } } int ascending_compare(const void *a, const void *b){ if (*(int*)a < *(int*)b){ return -1; }else if (*(int*)a == *(int*)b){ return 0; }else{ return 1; } } int lower_bound(int *a, int n, int key){ int left, mid, right; left = 0, right = n; mid = (left + right)/2; while ((left+1 != mid || mid+1 != right) && mid != left){ if (key > a[mid]){ left = mid; }else{ right = mid+1; } mid = (left + right)/2; } if (a[left] >= key)return left; if (a[mid] >= key)return mid; if (a[right] >= key)return right; return n; } //greatest common divisor unsigned long gcd(unsigned long x, unsigned long y){ if (y == 0){ return x; }else if (x > y){ return gcd(y, x % y); }else{ return gcd(x, y % x); } } long long factorial(int x){ long long rtn = 1; int i; for (i = x; i > 1; i--){ rtn = (rtn*i); } return rtn; } int backwords[1000100]; int main(void){ int xy[4]; int j = 0; for (int i = 0; i < 4; i++){ scanf("%d", &xy[i]); } for (int i = 0; i < xy[3]-xy[1]; i++){ printf("U"); backwords[j] = 'U'; j++; } for (int i = 0; i < xy[2]-xy[0]; i++){ printf("R"); backwords[j] = 'R'; j++; } for (int i = 0; i < j; i++){ if (backwords[i] == 'U'){ printf("D"); } if (backwords[i] == 'R'){ printf("L"); } } printf("L"); for (int i = 0; i < xy[3]-xy[1]; i++){ printf("U"); } printf("UR"); for (int i = 0; i < xy[2]-xy[0]; i++){ printf("R"); } printf("D"); printf("R"); for (int i = 0; i < xy[3]-xy[1]; i++){ printf("D"); } printf("DL"); for (int i = 0; i < xy[2]-xy[0]; i++){ printf("L"); } printf("U\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Back and Forth |
User | Morifo |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 2336 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:73:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &xy[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 128 KB |
sample_02.txt | AC | 1 ms | 128 KB |
subtask_1_01.txt | AC | 1 ms | 128 KB |
subtask_1_02.txt | AC | 1 ms | 128 KB |
subtask_1_03.txt | AC | 1 ms | 128 KB |
subtask_1_04.txt | AC | 1 ms | 128 KB |
subtask_1_05.txt | AC | 1 ms | 128 KB |
subtask_1_06.txt | AC | 1 ms | 128 KB |
subtask_1_07.txt | AC | 1 ms | 128 KB |
subtask_1_08.txt | AC | 1 ms | 128 KB |
subtask_1_09.txt | AC | 1 ms | 128 KB |
subtask_1_10.txt | AC | 1 ms | 128 KB |