Submission #47085159


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using ml = map<int, ll>;

#define endl '\n'
#define rep(i, n) for (int i = 0; i < (n); ++i)

#define rr read()
inline int read() {
    int num = 0, flag = 1, ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') flag = -1;
    for (; isdigit(ch); ch = getchar()) num = num * 10 + ch - '0';
    return num * flag;
}

ml mean(vi x) {
    ml ret[2]; ret[0][0] = 0ll;
    int k = 0; rep(i, x.size()) {
        ret[k ^= 1].clear(); for (auto t : ret[k ^ 1])
        ret[k][t.first + x[i]] = t.second | (1 << i), ret[k][t.first - x[i]] = t.second;
    } return ret[k];
}

ll solve(vi a, int x) {
    int n = a.size();
    vi L, R; rep(i, n) (i < n / 2 ? L : R).push_back(a[i]);
    ml l = mean(L), r = mean(R);
    for (auto i : l)
        if (r.count(x - i.first)) return i.second | (r[x - i.first] << n / 2);
    printf("No\n"), exit(0);
}

signed main() {
    int N = rr, X = rr, Y = rr; vi x, y;
    rep(i, N) (i & 1 ? x : y).push_back(rr);
    ll a = solve(x, X), b = solve(y, Y);
    printf("Yes\n");
    int d = 1; rep(i, N) {
        if (i & 1) putchar(((a >> i / 2) & 1) == d ? 'R' : 'L'), d = ((a >> (i >> 1)) & 1);
        else putchar(((b >> i / 2) & 1) == d ? 'L' : 'R'), d = ((b >> (i >> 1)) & 1);
    } return 0;
}

Submission Info

Submission Time
Task F - Robot Rotation
User RainPPR
Language C++ 17 (gcc 12.2)
Score 525
Code Size 1336 Byte
Status AC
Exec Time 1956 ms
Memory 231544 KiB

Compile Error

Main.cpp: In function ‘ml mean(vi)’:
Main.cpp:10:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   10 | #define rep(i, n) for (int i = 0; i < (n); ++i)
      |                                     ^
Main.cpp:22:16: note: in expansion of macro ‘rep’
   22 |     int k = 0; rep(i, x.size()) {
      |                ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 525 / 525
Status
AC × 4
AC × 48
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt, random_36.txt, random_37.txt, random_38.txt, random_39.txt, random_40.txt, random_41.txt, random_42.txt, random_43.txt, random_44.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
random_01.txt AC 1956 ms 231272 KiB
random_02.txt AC 1943 ms 231468 KiB
random_03.txt AC 1876 ms 231544 KiB
random_04.txt AC 1846 ms 230344 KiB
random_05.txt AC 1 ms 3548 KiB
random_06.txt AC 1 ms 3632 KiB
random_07.txt AC 646 ms 101416 KiB
random_08.txt AC 2 ms 3944 KiB
random_09.txt AC 1 ms 3488 KiB
random_10.txt AC 1 ms 3500 KiB
random_11.txt AC 30 ms 9680 KiB
random_12.txt AC 1 ms 3808 KiB
random_13.txt AC 1876 ms 230828 KiB
random_14.txt AC 152 ms 32260 KiB
random_15.txt AC 1 ms 3624 KiB
random_16.txt AC 1125 ms 197856 KiB
random_17.txt AC 79 ms 17964 KiB
random_18.txt AC 1 ms 3564 KiB
random_19.txt AC 1 ms 3584 KiB
random_20.txt AC 2 ms 3848 KiB
random_21.txt AC 1829 ms 230868 KiB
random_22.txt AC 965 ms 228724 KiB
random_23.txt AC 916 ms 229976 KiB
random_24.txt AC 1827 ms 227828 KiB
random_25.txt AC 1 ms 3508 KiB
random_26.txt AC 741 ms 118040 KiB
random_27.txt AC 1 ms 3556 KiB
random_28.txt AC 1 ms 3540 KiB
random_29.txt AC 1 ms 3488 KiB
random_30.txt AC 1 ms 3812 KiB
random_31.txt AC 1 ms 3500 KiB
random_32.txt AC 3 ms 4396 KiB
random_33.txt AC 942 ms 231188 KiB
random_34.txt AC 44 ms 17848 KiB
random_35.txt AC 931 ms 225952 KiB
random_36.txt AC 14 ms 6696 KiB
random_37.txt AC 1 ms 3564 KiB
random_38.txt AC 1 ms 3696 KiB
random_39.txt AC 1 ms 3608 KiB
random_40.txt AC 1 ms 3552 KiB
random_41.txt AC 1 ms 3460 KiB
random_42.txt AC 1 ms 3624 KiB
random_43.txt AC 1 ms 3556 KiB
random_44.txt AC 1 ms 3556 KiB
sample_01.txt AC 1 ms 3556 KiB
sample_02.txt AC 1 ms 3508 KiB
sample_03.txt AC 1 ms 3492 KiB
sample_04.txt AC 1 ms 3428 KiB