Submission #3587592

Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int s[2], t[2];
string d = "RULD";

string solve();

int main() {
  cin >> s[0] >> s[1] >> t[0] >> t[1];

  cout << solve() << endl;
  return 0;
}

string solve() {
  string ans;
  for(int i = 0; i < 4; ++i)
    for(int j = 0; j < t[i % 2] - s[i % 2]; ++j)
      ans += d[i];
  for(int i = 0; i < 4; ++i) {
    if(i % 2 == 0) ans += d[(i + 3) % 4];
    for(int j = 0; j < 1 + t[i % 2] - s[i % 2]; ++j)
      ans += d[i];
    if(i % 2 == 1) ans += d[(i + 1) % 4];
  }
  return ans;
}

Submission Info

Submission Time
Task C - Back and Forth
User m_tsubasa
Language C++14 (GCC 5.4.1)
Score 300
Code Size 556 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 300 / 300 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 1 ms 256 KB
sample_02.txt 1 ms 256 KB
subtask_1_01.txt 1 ms 256 KB
subtask_1_02.txt 1 ms 256 KB
subtask_1_03.txt 1 ms 256 KB
subtask_1_04.txt 1 ms 256 KB
subtask_1_05.txt 1 ms 256 KB
subtask_1_06.txt 1 ms 256 KB
subtask_1_07.txt 1 ms 256 KB
subtask_1_08.txt 1 ms 256 KB
subtask_1_09.txt 1 ms 256 KB
subtask_1_10.txt 1 ms 256 KB