QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#691838 | #6431. Oops, It's Yesterday Twice More | Zero# | WA | 0ms | 3820kb | C++20 | 1.7kb | 2024-10-31 13:10:49 | 2024-10-31 13:10:59 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize (3)
#define de(a) cout << #a << " = " << a << "\n";
#define deg(a) cout << #a << " = " << a << " ";
#define lowbit(x) ((x) & (-x))
#define int long long
#define siz(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define PII pair<int, int>
using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr ll inf = 1e18;
constexpr int N = 1e6 + 10;
int n, m;
int a[N];
void solve(int Case) {
int a, b;
cin >> n >> a >> b;
string ans(10 * n, 'U');
string s;
for (int i = 1; i < n; i++) s += 'U';
for (int i = 1; i < n; i++) s += 'L';
for (int i = 1; i < a; i++) s += 'R';
for (int i = 1; i < b; i++) s += 'D';
if (s.size() < ans.size()) ans = s;
s.clear();
for (int i = 1; i < n; i++) s += 'U';
for (int i = 1; i < n; i++) s += 'R';
for (int i = 1; i < n - a + 1; i++) s += 'L';
for (int i = 1; i < b; i++) s += 'D';
if (s.size() < ans.size()) ans = s;
s.clear();
for (int i = 1; i < n; i++) s += 'D';
for (int i = 1; i < n; i++) s += 'L';
for (int i = 1; i < a; i++) s += 'R';
for (int i = 1; i < n - b + 1; i++) s += 'U';
if (s.size() < ans.size()) ans = s;
s.clear();
for (int i = 1; i < n; i++) s += 'D';
for (int i = 1; i < n; i++) s += 'R';
for (int i = 1; i < n - a + 1; i++) s += 'L';
for (int i = 1; i < n - b + 1; i++) s += 'U';
if (s.size() < ans.size()) ans = s;
s.clear();
cout << ans << "\n";
}
signed main() {
cin.tie(0)->ios::sync_with_stdio(false);
int T = 1;
// cin >> T; cin.get();
int Case = 0;
while (++Case <= T) {
solve(Case);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
3 3 3
output:
DDRR
result:
ok n=3, x=3, y=3
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
4 3 2
output:
UUURRRLD
result:
wrong answer Failed