QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#235967 | #6431. Oops, It's Yesterday Twice More | ucup-team1001# | WA | 0ms | 3748kb | C++20 | 1.5kb | 2023-11-03 14:15:38 | 2023-11-03 14:15:38 |
Judging History
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();
}
详细
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