QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#836585#9915. General Symmetryucup-team3584#Compile Error//C++203.6kb2024-12-29 02:11:572024-12-29 02:11:58

Judging History

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

  • [2024-12-29 02:11:58]
  • 评测
  • [2024-12-29 02:11:57]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) { return (ull)rng() % B; }

template <int mod> struct static_modint {
    using mint = static_modint;
    int x;

    static_modint() : x(0) {}
    static_modint(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    mint &operator+=(const mint &rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator-=(const mint &rhs) {
        if ((x += mod - rhs.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator*=(const mint &rhs) {
        x = (int)(1LL * x * rhs.x % mod);
        return *this;
    }
    mint &operator/=(const mint &rhs) { return *this = *this * rhs.inv(); }

    mint pow(long long n) const {
        mint _x = *this, r = 1;
        while (n) {
            if (n & 1) r *= _x;
            _x *= _x;
            n >>= 1;
        }
        return r;
    }
    mint inv() const { return pow(mod - 2); }

    mint operator+() const { return *this; }
    mint operator-() const { return mint() - *this; }
    friend mint operator+(const mint &lhs, const mint &rhs) { return mint(lhs) += rhs; }
    friend mint operator-(const mint &lhs, const mint &rhs) { return mint(lhs) -= rhs; }
    friend mint operator*(const mint &lhs, const mint &rhs) { return mint(lhs) *= rhs; }
    friend mint operator/(const mint &lhs, const mint &rhs) { return mint(lhs) /= rhs; }
    friend bool operator==(const mint &lhs, const mint &rhs) { return lhs.x == rhs.x; }
    friend bool operator!=(const mint &lhs, const mint &rhs) { return lhs.x != rhs.x; }

    friend ostream &operator<<(ostream &os, const mint &p) { return os << p.x; }
    friend istream &operator>>(istream &is, mint &a) {
        int64_t t;
        is >> t;
        a = static_modint<mod>(t);
        return (is);
    }
};

const unsigned int mod = 998244353;
using modint = static_modint<mod>;
modint mod_pow(ll n, ll x) { return modint(n).pow(x); }
modint mod_pow(modint n, ll x) { return n.pow(x); }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int c = 0;
    vector<int> R(n);
    for (int i = 0; i < a.size(); ++i) {
        int l = c - (i - c);
        if (i + R[l] < c + R[c]) {
            R[i] = R[l];
        } else {
            int j = c + R[c] - i;
            while (i - j >= 0 && i + j < n && abs(a[i - j] - a[i + j]) <= k) {
                ++j;
            }
            R[i] = j;
            c = i;
        }
    }

    vector<int> b(n + n - 1);
    for (int i = 0; i < n; ++i) {
        b[i * 2] = a[i];
        if (i + 1 < n) {
            b[i * 2 + 1] = 1e9;
        }
    }
    vector<int> RR(n + n - 1);
    c = 0;
    for (int i = 0; i < b.size(); ++i) {
        int l = c - (i - c);
        if (i + RR[l] < c + RR[c]) {
            RR[i] = RR[l];
        } else {
            int j = c + RR[c] - i;
            while (i - j >= 0 && i + j < b.size() && abs(b[i - j] - b[i + j]) <= k) {
                ++j;
            }
            RR[i] = j;
            c = i;
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << R[i] * 2 - 1 << " ";
    }
    cout << "\n";
    for (int i = 0; i < b.size(); ++i) {
        cout << b[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < RR.size(); ++i) {
        cout << RR[i] << " ";
    }
}

uso

詳細信息

answer.code:126:1: error: ‘uso’ does not name a type
  126 | uso
      | ^~~