提出 #75106309


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define pb push_back

template<class T> inline bool chmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template<class T> inline bool chmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int MOD = 1e9 + 7;

void solve() {
    int n,a,b;cin>>n>>a>>b;
    // start from blac to black at last , odd number of white;

    if(n&1){
        cout<<"No\n";
        return;
    }
    if((a+b)%2==0){
        cout<<"No\n";
        return;
    }
    cout<<"Yes\n";
    string ans="";
    int hole=(a-1)/2;
    for(int i=0;i<n/2;i++){
        if(i<hole){
            ans+=string(n-1,'R')+"D"+string(n-1,'L');
        }else if(i==hole){
            int curr=i*2+1;
            for(int c=1;c<=n;c++){
                if(c==b){
                    

                }else{
                    if(curr==i*2+1){
                        ans+="D";
                        curr++;
                    }else {
                        ans+="U";
                        curr--;
                    }
                }
                if(c<n)ans+="R";
            }
        }else if(i>hole){
            ans+=string(n-1,'L')+"D"+string(n-1,'R');
        }
        if(i<(n/2)-1)ans+="D";
    }
    cout<<ans<<'\n';



    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tt = 1;
    cin>>tt;
    while (tt--) {
        solve();
    }

    return 0;
}

提出情報

提出日時
問題 E - LRUD Moving
ユーザ lavi3
言語 C++23 (GCC 15.2.0)
得点 450
コード長 1642 Byte
結果 AC
実行時間 4 ms
メモリ 8272 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 450 / 450
結果
AC × 1
AC × 30
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 3 ms 6236 KiB
01_handmade_00.txt AC 4 ms 8184 KiB
01_handmade_01.txt AC 3 ms 7316 KiB
01_handmade_02.txt AC 3 ms 7256 KiB
01_handmade_03.txt AC 3 ms 8180 KiB
01_handmade_04.txt AC 3 ms 7324 KiB
01_handmade_05.txt AC 3 ms 7356 KiB
01_handmade_06.txt AC 3 ms 7320 KiB
01_handmade_07.txt AC 3 ms 8272 KiB
01_handmade_08.txt AC 3 ms 7156 KiB
01_handmade_09.txt AC 2 ms 6524 KiB
01_handmade_10.txt AC 3 ms 6544 KiB
01_handmade_11.txt AC 3 ms 6304 KiB
01_handmade_12.txt AC 2 ms 6364 KiB
01_handmade_13.txt AC 2 ms 6472 KiB
01_handmade_14.txt AC 2 ms 6388 KiB
01_handmade_15.txt AC 2 ms 6432 KiB
02_random_00.txt AC 3 ms 7260 KiB
02_random_01.txt AC 3 ms 7272 KiB
02_random_02.txt AC 3 ms 7316 KiB
02_random_03.txt AC 3 ms 7256 KiB
02_random_04.txt AC 3 ms 7292 KiB
02_random_05.txt AC 4 ms 6344 KiB
02_random_06.txt AC 3 ms 6544 KiB
02_random_07.txt AC 2 ms 6352 KiB
02_random_08.txt AC 2 ms 6264 KiB
02_random_09.txt AC 2 ms 6556 KiB
02_random_10.txt AC 2 ms 6300 KiB
02_random_11.txt AC 2 ms 6332 KiB
02_random_12.txt AC 2 ms 6528 KiB