QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235967#6431. Oops, It's Yesterday Twice Moreucup-team1001#WA 0ms3748kbC++201.5kb2023-11-03 14:15:382023-11-03 14:15:38

Judging History

你现在查看的是最新测评结果

  • [2023-11-03 14:15:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2023-11-03 14:15:38]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define endl "\n"
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define lowbit(x) x&(-x)

void solve() {
    int n, x, y;
    cin >> n >> x >> y;
    auto get = [&](int x, int y, int x1, int y1) {
        string s = "";
        if (x > x1) {
            for (int i = 0; i < x - x1; i++) {
                s += "L";
            }
        } else {
            for (int i = 0; i < x1 - x; i++) {
                s += "R";
            }
        }
        if (y > y1) {
            for (int i = 0; i < y - y1; i++) {
                s += "U";
            }
        } else {
            for (int i = 0; i < y1 - y; i++) {
                s += "D";
            }
        }
        return s;
    };
    string s1 = get(1, 1, n, n) + get(n, n, x, y);
    if (s1.length() <= 3 * (n - 1)) {
        cout << s1 << endl;
        return;
    }
    s1 = get(1, n, n, 1) + get(n, 1, x, y);
    if (s1.length() <= 3 * (n - 1)) {
        cout << s1 << endl;
        return;
    }
    s1 = get(n, 1, 1, n) + get(1, n, x, y);
    if (s1.length() <= 3 * (n - 1)) {
        cout << s1 << endl;
        return;
    }
    s1 = get(n, n, 1, 1) + get(n, n, x, y);
    if (s1.length() <= 3 * (n - 1)) {
        cout << s1 << endl;
        return;
    }
    assert(0);
}


int main() {
    IOS
    int t;
//    cin >> t;
    t = 1;
    while (t--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3748kb

input:

3 3 3

output:

RRDD

result:

ok n=3, x=3, y=3

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3532kb

input:

4 3 2

output:

RRRDDDLUU

result:

wrong answer Failed