QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#862325#9977. Norte da Universidadeucup-team2796#Compile Error//C++178.8kb2025-01-18 23:57:362025-01-18 23:58:00

Judging History

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

  • [2025-01-18 23:58:00]
  • 评测
  • [2025-01-18 23:57:36]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

/**
 * @brief template
 */

template <unsigned mod = 1000000007> struct fp {
    unsigned v;
    static constexpr int get_mod() {
        return mod;
    }
    constexpr unsigned inv() const {
        assert(v != 0);
        int x = v, y = mod, p = 1, q = 0, t = 0, tmp = 0;
        while (y > 0) {
            t = x / y;
            x -= t * y, p -= t * q;
            tmp = x, x = y, y = tmp;
            tmp = p, p = q, q = tmp;
        }
        if (p < 0)
            p += mod;
        return p;
    }
    constexpr fp(ll x = 0) : v(x >= 0 ? x % mod : (mod - (-x) % mod) % mod) {}
    fp operator-() const {
        return fp() - *this;
    }
    fp pow(ull t) {
        fp res = 1, b = *this;
        while (t) {
            if (t & 1)
                res *= b;
            b *= b;
            t >>= 1;
        }
        return res;
    }
    fp &operator+=(const fp &x) {
        if ((v += x.v) >= mod)
            v -= mod;
        return *this;
    }
    fp &operator-=(const fp &x) {
        if ((v += mod - x.v) >= mod)
            v -= mod;
        return *this;
    }
    fp &operator*=(const fp &x) {
        v = ull(v) * x.v % mod;
        return *this;
    }
    fp &operator/=(const fp &x) {
        v = ull(v) * x.inv() % mod;
        return *this;
    }
    fp operator+(const fp &x) const {
        return fp(*this) += x;
    }
    fp operator-(const fp &x) const {
        return fp(*this) -= x;
    }
    fp operator*(const fp &x) const {
        return fp(*this) *= x;
    }
    fp operator/(const fp &x) const {
        return fp(*this) /= x;
    }
    bool operator==(const fp &x) const {
        return v == x.v;
    }
    bool operator!=(const fp &x) const {
        return v != x.v;
    }
    friend istream &operator>>(istream &is, fp &x) {
        return is >> x.v;
    }
    friend ostream &operator<<(ostream &os, const fp &x) {
        return os << x.v;
    }
};

// template <unsigned mod> void rd(fp<mod> &x) {
//     fastio::rd(x.v);
// }
// template <unsigned mod> void wt(fp<mod> x) {
//     fastio::wt(x.v);
// }

template <typename T> T Inv(ll n) {
    static const int md = T::get_mod();
    static vector<T> buf({0, 1});
    assert(n > 0);
    n %= md;
    while (SZ(buf) <= n) {
        int k = SZ(buf), q = (md + k - 1) / k;
        buf.push_back(buf[k * q - md] * q);
    }
    return buf[n];
}

template <typename T> T Fact(ll n, bool inv = 0) {
    static const int md = T::get_mod();
    static vector<T> buf({1, 1}), ibuf({1, 1});
    assert(n >= 0 and n < md);
    while (SZ(buf) <= n) {
        buf.push_back(buf.back() * SZ(buf));
        ibuf.push_back(ibuf.back() * Inv<T>(SZ(ibuf)));
    }
    return inv ? ibuf[n] : buf[n];
}

template <typename T> T nPr(int n, int r, bool inv = 0) {
    if (n < 0 || n < r || r < 0)
        return 0;
    return Fact<T>(n, inv) * Fact<T>(n - r, inv ^ 1);
}
template <typename T> T nCr(int n, int r, bool inv = 0) {
    if (n < 0 || n < r || r < 0)
        return 0;
    return Fact<T>(n, inv) * Fact<T>(r, inv ^ 1) * Fact<T>(n - r, inv ^ 1);
}
template <typename T> T nHr(int n, int r, bool inv = 0) {
    return nCr<T>(n + r - 1, r, inv);
}

/**
 * @brief Modint
 */

using Fp = fp<998244353>;

int dx[4] = {-1,0,1,0}, dy[4] = {0,-1,0,1};

void Solve() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> A(N, vector<int>(M, -1));
    vector<string> S(N);
    rep(i,0,N) cin >> S[i];
    {
        rep(i,0,N) {
            rep(j,0,M) {
                if (S[i][j] == 'N') A[i][j] = 0;
                if (S[i][j] == 'W') A[i][j] = 1;
                if (S[i][j] == 'S') A[i][j] = 2;
                if (S[i][j] == 'E') A[i][j] = 3;
            }
        }
    }
    vector<vector<vector<bool>>> B(N, vector<vector<bool>>(M, vector<bool>(4,true)));
    auto dox = [&](int i, int j, int d) -> void {
        rep(k,0,4) if (k != d) B[i][j][k] = false;
    };
    rep(i,0,N) {
        rep(j,0,M) {
            if (A[i][j] >= 0) {
                rep(k,0,4) if (k != A[i][j]) B[i][j][k] = false;
            }
        }
    }
    rep(i,0,N) {
        bool canw = true, doe = false;
        rep(j,0,M) {
            if (S[i][j] == 'E') doe = true;
            if (S[i][j] != 'W' && S[i][j] != '?') canw = false;
            if (doe) dox(i,j,3);
            if (!canw) B[i][j][1] = false;
        }
    }
    rep(i,0,N) {
        bool cane = true, dow = false;
        rrep(j,0,M) {
            if (S[i][j] == 'W') dow = true;
            if (S[i][j] != 'E' && S[i][j] != '?') cane = false;
            if (dow) dox(i,j,1);
            if (!cane) B[i][j][3] = false;
        }
    }
    rep(j,0,M) {
        bool cann = true, dos = false;
        rep(i,0,N) {
            if (S[i][j] == 'S') dos = true;
            if (S[i][j] != 'N' && S[i][j] != '?') cann = false;
            if (dos) dox(i,j,2);
            if (!cann) B[i][j][0] = false;
        }
    }
    rep(j,0,M) {
        bool cans = true, don = false;
        rrep(i,0,N) {
            if (S[i][j] == 'N') don = true;
            if (S[i][j] != 'S' && S[i][j] != '?') cans = false;
            if (don) dox(i,j,0);
            if (!cans) B[i][j][2] = false;
        }
    }
    rep(i,0,N) {
        rep(j,0,M) {
            bool check = false;
            rep(k,0,4) if (B[i][j][k]) check = true;
            if (!check) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    Fp ANS = 0;
    // N and S are adjacent
    {

    }
    // W and E are adjacent
    {

    }
    // all are adjacent at a corner
    {

    }
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
int _;
cin >> _;
while(_--) {
}
}

Details

answer.code: In function ‘void Solve()’:
answer.code:314:24: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
  314 |                 return 0;
      |                        ^