提出 #75083398


ソースコード 拡げる

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <map>
#include <queue>
#include <unordered_set>
#include <cassert>
#include <list>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numbers>
#include <iostream>
#include <string>
#include <random>

using namespace std;

#define fori(n)for (int i = 0; i < n; i++)
#define fo(n)for (int i = 0; i < n; i++)
#define fori1(n)for (ll i = 1; i < n + 1; i++)
#define revi1(n)for (int i = n; i >=0; i--)
#define forj(n)for (ll j = 0; j < (n); j++)
#define rep(i, n)for (ll i = 0; i < (n); i++)
#define repj(i, j, n)for (ll i = j; i < (n); i++)
#define forj1(n)for (ll j = 1; j < n+1; j++)
#define revj1(n)for (ll j = n; j >=0; j--)
#define revi(n)for (int i = n-1; i >= 0; i--)
#define ll long long
#define ull unsigned ll
#define MAXN (2147483647)
#define MINN (-2147483648)
#define ffast_io ios::sync_with_stdio(false);\
                 cout.tie(nullptr); cin.tie(nullptr)

string svo(bool fl) {
    if (fl)
        return "YES";
    return "NO";
}

vector<vector<ll>> multi(vector<vector<ll>> a, vector<vector<ll>> b) {
    vector<vector<ll>> res(a.size(), vector<ll>(b[0].size(), 0));
    fori(a.size()) {
        forj(b[0].size()) {
            ll temp = 0;
            rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
            res[i][j] = temp;
        }
    }
    return res;
}

vector<vector<ll>> pow(const vector<vector<ll>> &mat, int powred) {
    if (powred == 1) return mat;
    if (powred % 2 == 1) return multi(pow(mat, powred - 1), mat);
    vector<vector<ll>> temp = pow(multi(mat, mat), powred / 2);
    return temp;
}

ll pow1(ll mat, ll powred) {
    if (powred == 1L) return mat;
    if ((powred % 2LL) == 1LL) return (pow1(mat, powred - 1LL) * mat) % 10LL;
    auto temp = pow1((mat * mat) % 10LL, powred / 2LL);
    return temp;
}

template<typename T>
void debug(const std::vector<T> &ttt, std::ostream &out = std::cout) {
    int temp = 1;
    for (auto it = ttt.begin(); it != ttt.end(); ++it, temp++) out << *it << ' ';
    out << std::endl;
}

template<typename T>
void debug(const std::vector<vector<T>> &ttt, std::ostream &out = std::cout) {
    for (int it = 0; it != ttt.size(); ++it) debug(ttt[it]);
}

template<typename T>
void debug(set<T> ttt, std::ostream &out = std::cout) {
    for (auto t: ttt) out << t << " ";
    out << endl;
}

void debug(bool k, std::ostream &out = std::cout) { if (k) out << "yes"; else out << "no"; }

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,tune=native")


std::vector<int> prefix_function(const std::string &s) {
    int n = s.size();
    std::vector<int> pi(n);
    for (int i = 1; i < n; ++i) {
        int j = pi[i - 1];
        while (j > 0 && s[i] != s[j])
            j = pi[j - 1];
        if (s[i] == s[j]) ++j;
        pi[i] = j;
    }
    return pi;
}

void cout_path(int n, int a, int b) {
    string res;
    int row = 0, col = 0;

    fori(n - 1) {
        if (i % 2 == 0) {
            forj(n - 1) {
                if (!(row == a && col + 1 == b)) {
                    res += 'R';
                }
                col++;
            }
        } else {
            for (int j = 0; j < n - 1; j++) {
                if (!(row == a && col - 1 == b)) {
                    res += 'L';
                }
                col--;
            }
        }

        if (!(row + 1 == a && col == b)) {
            res += 'D';
        }
        row++;
    }

    fori(n - 1) {
        if (!(row == a && col + 1 == b)) {
            res += 'R';
        }
        col++;
    }

    cout << res << "\n";
}

void solve() {
    int q;
    cin >> q;
    while (q--) {
        int n, a, b;
        cin >> n >> a >> b;
        a--;
        b--;
        if ((n & 1) == 1) {
            cout << "No" << "\n";
            continue;
        }
        cout << "Yes" << "\n";
        cout_path(n, a, b);
    }
}

int main() {
    ffast_io;

    solve();


    return 0;
}

提出情報

提出日時
問題 E - LRUD Moving
ユーザ kashapoV
言語 C++23 (GCC 15.2.0)
得点 0
コード長 4319 Byte
結果 WA
実行時間 5 ms
メモリ 5460 KiB

コンパイルエラー

./Main.cpp: In function 'std::vector<std::vector<long long int> > multi(std::vector<std::vector<long long int> >, std::vector<std::vector<long long int> >)':
./Main.cpp:26:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 | #define fori(n)for (int i = 0; i < n; i++)
      |                                  ^
./Main.cpp:51:5: note: in expansion of macro 'fori'
   51 |     fori(a.size()) {
      |     ^~~~
./Main.cpp:30:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | #define forj(n)for (ll j = 0; j < (n); j++)
      |                               ~~^~~~~
./Main.cpp:52:9: note: in expansion of macro 'forj'
   52 |         forj(b[0].size()) {
      |         ^~~~
./Main.cpp:31:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 | #define rep(i, n)for (ll i = 0; i < (n); i++)
      |                                   ^
./Main.cpp:54:13: note: in expansion of macro 'rep'
   54 |             rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
      |             ^~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 450
結果
WA × 1
AC × 2
WA × 28
セット名 テストケース
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 WA 1 ms 3412 KiB
01_handmade_00.txt WA 5 ms 5304 KiB
01_handmade_01.txt WA 5 ms 5232 KiB
01_handmade_02.txt WA 5 ms 5380 KiB
01_handmade_03.txt WA 5 ms 5340 KiB
01_handmade_04.txt WA 5 ms 5460 KiB
01_handmade_05.txt WA 5 ms 5336 KiB
01_handmade_06.txt WA 5 ms 5236 KiB
01_handmade_07.txt WA 5 ms 5308 KiB
01_handmade_08.txt WA 5 ms 5456 KiB
01_handmade_09.txt WA 5 ms 5292 KiB
01_handmade_10.txt WA 3 ms 3540 KiB
01_handmade_11.txt WA 3 ms 3540 KiB
01_handmade_12.txt WA 4 ms 3640 KiB
01_handmade_13.txt WA 4 ms 3612 KiB
01_handmade_14.txt WA 4 ms 3704 KiB
01_handmade_15.txt WA 4 ms 3612 KiB
02_random_00.txt WA 5 ms 5368 KiB
02_random_01.txt WA 5 ms 5352 KiB
02_random_02.txt WA 5 ms 5308 KiB
02_random_03.txt WA 5 ms 5292 KiB
02_random_04.txt WA 5 ms 5356 KiB
02_random_05.txt WA 4 ms 3576 KiB
02_random_06.txt WA 4 ms 3660 KiB
02_random_07.txt AC 1 ms 3504 KiB
02_random_08.txt AC 1 ms 3540 KiB
02_random_09.txt WA 2 ms 3796 KiB
02_random_10.txt WA 5 ms 5376 KiB
02_random_11.txt WA 2 ms 3708 KiB
02_random_12.txt WA 5 ms 5344 KiB