QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#50679#1265. Total Eclipseckiseki#Compile Error//C++2.9kb2022-09-28 15:55:302022-09-28 15:55:30

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-28 15:55:30]
  • Judged
  • [2022-09-28 15:55:30]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

struct MinCostFlow {
    using Cap = int;
    using Wei = int64_t;
    using PCW = pair<Cap, Wei>;
    static constexpr Cap INT_CAP = 1 << 30;
    static constexpr Wei INF_WEI = 1LL << 60;
private:
    struct Edge {
        int to, back;
        Cap cap;
        Wei wei;
        Edge() {}
        Edge(int a, int b, Cap c, Wei d) : to(a), back(b), cap(c), wei(d) {}
    };
    int ori, edd;
    vector<vector<Edge>> G;
    vector<int> fa, wh;
    vector<bool> inq;
    vector<Wei> dis;
    PCW SPFA() {
        fill(inq.begin(), inq.end(), false);
        fill(dis.begin(), dis.end(), INF_WEI);
        queue<int> qq; qq.push(ori);
        dis[ori] = 0;
        while (not qq.empty()) {
            int u = qq.front(); qq.pop();
            inq[u] = false;
            for (int i = 0; i < (int)G[u].size(); i++) {
                Edge e = G[u][i];
                int v = e.to; Wei d = e.wei;
                if (e.cap <= 0 || dis[v] <= dis[u] + d)
                    continue;
                dis[v] = dis[u] + d;
                fa[v] = u;
                wh[v] = i;
                if (inq[v]) continue;
                qq.push(v);
                inq[v] = true;
            }
        }
        if (dis[edd] == INF_WEI)
            return { -1, -1 };
        Cap mw = INF_CAP;
        for (int i = edd; i != ori; i = fac[i])
            mw = min(mw, G[fa[i]][wh[i]].cap);
        for (int i = edd; i != ori; i = fa[i]) {
            auto &eg = G[fa[i]][wh[i]];
            eg.cap -= mw;
            G[eg.ot][eg.back].cap += mw;
        }
        return { mw, dis[edd] };
    }
public:
    void init(int n) {
        G.clear(); G.resize(n);
        fa.resize(n);
        wh.resize(n);
        inq.resize(n);
        dis.resize(n);
    }
    void add_edge(int st, int ed, Cap c, Wei w) {
        G[st].emplace_back(ed, G[ed].size(), c, w);
        G[ed].emplace_back(st, G[st].size()-1, 0, -w);
    }
    PCW solve(int a, int b) {
        ori = a, edd = b;
        Cap cc = 0;
        Wei ww = 0;
        while (true) {
            PCW ret = SPFA();
            if (ret.first == -1) break;
            cc += ret.first;
            ww += ret.first * ret.second;
        }
        return { cc, ww };
    }
} mcmf;


int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int t; cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        map<int,int> mp;
        int tot = n;
        const auto getid = [&](int x) {
            if (mp.count(x)) {
                ;
            } else {
                mp[x] = tot++;
            }
        };
        for (int i = 0; i < n; i++) {
            int a, b, c;
            cin >> a >> b >> c;
            int x = round(-b / llf(2 * a));
            for (int y = -26 + x; y <= 26 + x; y++) {
                if (1 <= y && y <= m) {
                    int id = getid(y);
                }
            }
        }
    }
    return 0;
}

Details

answer.code: In member function ‘MinCostFlow::PCW MinCostFlow::SPFA()’:
answer.code:46:18: error: ‘INF_CAP’ was not declared in this scope; did you mean ‘INT_CAP’?
   46 |         Cap mw = INF_CAP;
      |                  ^~~~~~~
      |                  INT_CAP
answer.code:47:41: error: ‘fac’ was not declared in this scope; did you mean ‘fa’?
   47 |         for (int i = edd; i != ori; i = fac[i])
      |                                         ^~~
      |                                         fa
answer.code:52:18: error: ‘struct MinCostFlow::Edge’ has no member named ‘ot’; did you mean ‘to’?
   52 |             G[eg.ot][eg.back].cap += mw;
      |                  ^~
      |                  to
answer.code: In function ‘int main()’:
answer.code:101:32: error: ‘llf’ was not declared in this scope
  101 |             int x = round(-b / llf(2 * a));
      |                                ^~~
answer.code:104:35: error: void value not ignored as it ought to be
  104 |                     int id = getid(y);
      |                              ~~~~~^~~