Submission #1070393


Source Code Expand

#include <iostream>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>


typedef long double ld;
typedef long long ll;
using namespace std;
const ll MX=5e6+9;
const ld pi = acos(-1);
const ll mod = 1e8;

//bool cmp ( int a,int b ) { return a>b; }

ll po ( ll a , ll b )
{
    if ( b==0 ) { return 1; }
    ll x = po ( a , b/2 );
    x *= x%mod;
    if ( b%2 ) { x*=a%mod; }
    return x%mod;
}

ll gcd (  ll a , ll b )
{
    if ( b==0 ) return a;
    else { gcd( b , a%b ); }
}
bool cmp ( int a , int b ) { return (a>b); }
int dx[]={ 0 , 0 , -1 , 1 , 1 , -1 , -1 , 1 };
int dy[]={ 1 , -1 , 0 , 0 , 1 , -1 , 1 , -1 };
ll a[MX],b[MX],c[MX];
int n,m,l;


ll bs ( ll x , ll id )
{
    ll st,en,mid;
    if ( id==2 )
    {
        st=0,en=m;
    }
    else { st=0,en=l; }
    ll ans=0;
    if ( id==2 ){
    ans=m-1;
    while ( st<=en )
    {
        mid = st+(en-st)/2;
        if ( b[mid]>=x ) { ans=mid; en=mid-1; }
        else { st=mid+1; }
    }
    }
    else
    {
    ans=l-1;
    while ( st<=en )
    {
        mid = st+(en-st)/2;
        if ( c[mid]>=x ) { ans=mid; en=mid-1; }
        else { st=mid+1; }
    }
    }
    return ans;



}

int main()
{
    int x,y,s,e;
    cin>>x>>y>>s>>e;
    string ans;

    int xx=x,yy=y;

    while ( xx<s ) { ans += "R"; xx++; }
    while ( yy<e ) { ans += "U"; yy++; }

    for ( int i=0 ; i<ans.length() ; i++ )
    {
        if ( ans[i]=='U' ) { ans+= "D"; }
        if ( ans[i]=='R' ) { ans+= "L"; }
    }

    ans += "D";
    xx = x;
    yy = y-1;

    while ( xx<=s ) { ans += "R"; xx++; }
    while ( yy<e ) { ans += "U"; yy++; }

    ans += "L";
    ans += "U";

    xx = s;
    yy = e+1;

    while ( xx>=x ) { ans += "L"; xx--; }
    while ( yy>y  ) { ans += "D"; yy--; }

    ans += "R";

    cout<<ans;



	return 0;
}

Submission Info

Submission Time
Task C - Back and Forth
User Reckt
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2257 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Judge Result

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