QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#671156#898. 二分图最大匹配QingyyxCompile Error//C++201.2kb2024-10-24 11:19:342024-10-24 11:19:35

Judging History

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

  • [2024-10-24 11:19:35]
  • 评测
  • [2024-10-24 11:19:34]
  • 提交

answer

int px[MAXN], py[MAXN];
int pre[MAXN], vis[MAXN], TC;
void aug(int x) {
    while (x) {
        int tmp = px[pre[x]];
        px[pre[x]] = x;
        py[x] = pre[x];
        x = tmp;
    }
}
bool bfs(int x) {
    vector<int>vec;
    queue<int>que;
    que.push(x);
    while (!que.empty()) {
        int u = que.front();
        que.pop();
        for (int i = head[u]; ~i; i = e[i].nxt) {
            int v = e[i].to;
            if (vis[v] == TC)continue;
            vis[v] = TC;
            pre[v] = u;
            vec.push_back(v);
            if (!py[v]) {
                aug(v);
                for (auto x : vec) pre[x] = 0;
                return 1;
            } else {
                que.push(py[v]);
            }
        }
    }
    for (auto x : vec) pre[x] = 0;
    return 0;
}

void solve() {
    L = read(), R = read(), m = read();
    clear(max(L, R));
    for (int i = 1; i <= m; ++i) {
        int u = read() + 1, v = read() + 1;
        add(u, v);
    }
    int ans = 0;
    for (int i = 1; i <= L; i++) {
        ++TC;
        ans += bfs(i);
    }
    printf("%d\n", ans);
    for (int i = 1; i <= L; ++i)
        if (px[i])printf("%d %d\n", i - 1, px[i] - 1);
}

詳細信息

answer.code:1:8: error: ‘MAXN’ was not declared in this scope
    1 | int px[MAXN], py[MAXN];
      |        ^~~~
answer.code:1:18: error: ‘MAXN’ was not declared in this scope
    1 | int px[MAXN], py[MAXN];
      |                  ^~~~
answer.code:2:9: error: ‘MAXN’ was not declared in this scope
    2 | int pre[MAXN], vis[MAXN], TC;
      |         ^~~~
answer.code:2:20: error: ‘MAXN’ was not declared in this scope
    2 | int pre[MAXN], vis[MAXN], TC;
      |                    ^~~~
answer.code: In function ‘void aug(int)’:
answer.code:5:19: error: ‘px’ was not declared in this scope; did you mean ‘x’?
    5 |         int tmp = px[pre[x]];
      |                   ^~
      |                   x
answer.code:5:22: error: ‘pre’ was not declared in this scope
    5 |         int tmp = px[pre[x]];
      |                      ^~~
answer.code:7:9: error: ‘py’ was not declared in this scope
    7 |         py[x] = pre[x];
      |         ^~
answer.code: In function ‘bool bfs(int)’:
answer.code:12:5: error: ‘vector’ was not declared in this scope
   12 |     vector<int>vec;
      |     ^~~~~~
answer.code:12:12: error: expected primary-expression before ‘int’
   12 |     vector<int>vec;
      |            ^~~
answer.code:13:5: error: ‘queue’ was not declared in this scope
   13 |     queue<int>que;
      |     ^~~~~
answer.code:13:11: error: expected primary-expression before ‘int’
   13 |     queue<int>que;
      |           ^~~
answer.code:14:5: error: ‘que’ was not declared in this scope
   14 |     que.push(x);
      |     ^~~
answer.code:18:22: error: ‘head’ was not declared in this scope
   18 |         for (int i = head[u]; ~i; i = e[i].nxt) {
      |                      ^~~~
answer.code:18:39: error: ‘e’ was not declared in this scope
   18 |         for (int i = head[u]; ~i; i = e[i].nxt) {
      |                                       ^
answer.code:20:17: error: ‘vis’ was not declared in this scope
   20 |             if (vis[v] == TC)continue;
      |                 ^~~
answer.code:21:13: error: ‘vis’ was not declared in this scope
   21 |             vis[v] = TC;
      |             ^~~
answer.code:22:13: error: ‘pre’ was not declared in this scope
   22 |             pre[v] = u;
      |             ^~~
answer.code:23:13: error: ‘vec’ was not declared in this scope
   23 |             vec.push_back(v);
      |             ^~~
answer.code:24:18: error: ‘py’ was not declared in this scope
   24 |             if (!py[v]) {
      |                  ^~
answer.code:33:19: error: ‘vec’ was not declared in this scope
   33 |     for (auto x : vec) pre[x] = 0;
      |                   ^~~
answer.code:33:24: error: ‘pre’ was not declared in this scope
   33 |     for (auto x : vec) pre[x] = 0;
      |                        ^~~
answer.code: In function ‘void solve()’:
answer.code:38:5: error: ‘L’ was not declared in this scope
   38 |     L = read(), R = read(), m = read();
      |     ^
answer.code:38:9: error: ‘read’ was not declared in this scope
   38 |     L = read(), R = read(), m = read();
      |         ^~~~
answer.code:38:17: error: ‘R’ was not declared in this scope
   38 |     L = read(), R = read(), m = read();
      |                 ^
answer.code:38:29: error: ‘m’ was not declared in this scope
   38 |     L = read(), R = read(), m = read();
      |                             ^
answer.code:39:11: error: ‘max’ was not declared in this scope
   39 |     clear(max(L, R));
      |           ^~~
answer.code:39:5: error: ‘clear’ was not declared in this scope
   39 |     clear(max(L, R));
      |     ^~~~~
answer.code:42:16: error: ‘v’ was not declared in this scope
   42 |         add(u, v);
      |                ^
answer.code:42:9: error: ‘add’ was not declared in this scope
   42 |         add(u, v);
      |         ^~~
answer.code:49:5: error: ‘printf’ was not declared in this scope
   49 |     printf("%d\n", ans);
      |     ^~~~~~
answer.code:1:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | int px[MAXN], py[MAXN];
answer.code:51:13: error: ‘px’ was not declared in this scope
   51 |         if (px[i])printf("%d %d\n", i - 1, px[i] - 1);
      |             ^~