QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197857 | #6431. Oops, It's Yesterday Twice More | LilyWhite | WA | 0ms | 3692kb | C++20 | 2.5kb | 2023-10-02 20:58:16 | 2023-10-02 20:58:16 |
Judging History
answer
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repr(i, m, n) for (int i = (int)m; i <= (int)n; i++)
#define repd(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#ifdef LILYWHITE
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) ;
#endif
const int __attribute__((unused)) INF = 0x3f3f3f3f;
template <typename T> inline T rd(T &x) {
x = 0;
T neg = 1;
char c = 0;
while (c < '0' || c > '9') {
if (c == '-')
neg = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - 48;
c = getchar();
}
x *= neg;
return x;
}
template <typename T, typename... Args> inline void rd(T &x, Args &...args) {
rd(x);
rd(args...);
}
int main() {
int n, a, b;
rd(n, a, b);
int dist1 = abs(a - 1) + abs(b - 1),
dist2 = abs(a - n) + abs(b - n),
dist3 = abs(a - 1) + abs(b - n),
dist4 = abs(a - n) + abs(b - 1);
int m = min(dist1, min(dist2, min(dist3, dist4)));
if (dist1 == m) {
rep(i, n - 1) cout.put('L');
rep(i, n - 1) cout.put('U');
rep(i, a - 1) cout.put('R');
rep(i, b - 1) cout.put('D');
} else if (dist2 == m) {
rep(i, n - 1) cout.put('R');
rep(i, n - 1) cout.put('D');
rep(i, n - a) cout.put('L');
rep(i, n - b) cout.put('U');
} else if (dist3 == m) {
rep(i, n - 1) cout.put('R');
rep(i, n - 1) cout.put('U');
rep(i, a - 1) cout.put('L');
rep(i, n - b) cout.put('D');
} else if (dist4 == m) {
rep(i, n - 1) cout.put('L');
rep(i, n - 1) cout.put('D');
rep(i, n - a) cout.put('R');
rep(i, b - 1) cout.put('U');
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
3 3 3
output:
RRDD
result:
ok n=3, x=3, y=3
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 3 2
output:
LLLDDDRU
result:
ok n=4, x=3, y=2
Test #3:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 1 1
output:
LU
result:
ok n=2, x=1, y=1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
500 250 250
output:
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...
result:
ok n=500, x=250, y=250
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
input:
500 250 249
output:
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...
result:
wrong answer Failed