QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691838#6431. Oops, It's Yesterday Twice MoreZero#WA 0ms3820kbC++201.7kb2024-10-31 13:10:492024-10-31 13:10:59

Judging History

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

  • [2024-10-31 13:10:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-10-31 13:10:49]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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