QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130966#996. 割点Yansuan_HCl#Compile Error//C++142.7kb2023-07-25 21:46:572023-07-25 21:47:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-25 21:47:01]
  • 评测
  • [2023-07-25 21:46:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define IC isdigit(c)
#define GC c=getchar()
void rd(auto &x) { x = 0; char GC, f = 0;
    for (; !IC; GC) if (c == '-') f ^= 1;
    for (; IC; GC) x = x * 10 + c - 48;
    if (f) x = -x;
}
void rd(auto &x, auto &...y) { rd(x); rd(y...); }
#define U(i,l,r) for(int i(l),END##i(r);i<=END##i;++i)
#define D(i,l,r) for(int i(l),END##i(r);i>=END##i;--i)

const int N = 20004, M = 200005;
struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
void add(int u, int v) {
    eg[++ptr] = {v, tail[u]};
    tail[u] = ptr;
}

int dfn[N], low[N], cut[N], dfp;
void tarjan(int u, int f) {
    int cnt = 0, flag = 0;
    dfn[u] = low[u] = ++dfp;
    for (int p = tail[u]; p; p = eg[p].pre) if ((p >> 1) != f) {
        int v = eg[p].v;
        if (!dfn[v]) {
            tarjan(v, p >> 1);
            low[u] = min(low[u], low[v]);
            ++cnt;
            if (low[v] >= dfn[u])
                cut[u] = 1;
        } else {
            low[u] = min(low[u], dfn[v]);
        }
    }
    if (!f && cnt > 1)
        cut[u] = 1;
}

int n, m;
int main() {
    rd(n, m);
    while (m--) {
        int u, v; rd(u, v);
        add(u, v);
        add(v, u);
    }
    U (i, 1, n) if (!dfn[i])
        tarjan(i, 0);
    U (i, 1, n) if (cut[i])
        printf("%d\n", i);
}#include <bits/stdc++.h>
using namespace std;
#define IC isdigit(c)
#define GC c=getchar()
void rd(auto &x) { x = 0; char GC, f = 0;
    for (; !IC; GC) if (c == '-') f ^= 1;
    for (; IC; GC) x = x * 10 + c - 48;
    if (f) x = -x;
}
void rd(auto &x, auto &...y) { rd(x); rd(y...); }
#define U(i,l,r) for(int i(l),END##i(r);i<=END##i;++i)
#define D(i,l,r) for(int i(l),END##i(r);i>=END##i;--i)

const int N = 20004, M = 200005;
struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
void add(int u, int v) {
    eg[++ptr] = {v, tail[u]};
    tail[u] = ptr;
}

int dfn[N], low[N], cut[N], dfp;
void tarjan(int u, int f) {
    int cnt = 0, flag = 0;
    dfn[u] = low[u] = ++dfp;
    for (int p = tail[u]; p; p = eg[p].pre) if ((p >> 1) != f) {
        int v = eg[p].v;
        ++cnt; // 非 1 号节点不会有返祖边
        if (!dfn[v]) {
            tarjan(v, p >> 1);
            low[u] = min(low[u], low[v]);

        } else {
            low[u] = min(low[u], dfn[v]);
        }
        if (low[v] >= dfn[u])
            flag = 1;
    }
    if (flag && (f || cnt > 1))
        cut[u] = 1;
}

int n, m;
int main() {
    rd(n, m);
    while (m--) {
        int u, v; rd(u, v);
        add(u, v);
        add(v, u);
    }
    U (i, 1, n) if (!dfn[i])
        tarjan(i, 0);
    U (i, 1, n) if (cut[i])
        printf("%d\n", i);
}

Details

answer.code:53:2: error: stray ‘#’ in program
   53 | }#include <bits/stdc++.h>
      |  ^
answer.code:5:9: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
    5 | void rd(auto &x) { x = 0; char GC, f = 0;
      |         ^~~~
answer.code:10:9: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
   10 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |         ^~~~
answer.code:10:18: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
   10 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |                  ^~~~
answer.code:53:3: error: ‘include’ does not name a type
   53 | }#include <bits/stdc++.h>
      |   ^~~~~~~
answer.code:57:9: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
   57 | void rd(auto &x) { x = 0; char GC, f = 0;
      |         ^~~~
answer.code:57:6: error: redefinition of ‘template<class auto:4> void rd(auto:4&)’
   57 | void rd(auto &x) { x = 0; char GC, f = 0;
      |      ^~
answer.code:5:6: note: ‘template<class auto:1> void rd(auto:1&)’ previously declared here
    5 | void rd(auto &x) { x = 0; char GC, f = 0;
      |      ^~
answer.code:62:9: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
   62 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |         ^~~~
answer.code:62:18: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
   62 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |                  ^~~~
answer.code:62:6: error: redefinition of ‘template<class auto:5, class ... auto:6> void rd(auto:5&, auto:6& ...)’
   62 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |      ^~
answer.code:10:6: note: ‘template<class auto:2, class ... auto:3> void rd(auto:2&, auto:3& ...)’ previously declared here
   10 | void rd(auto &x, auto &...y) { rd(x); rd(y...); }
      |      ^~
answer.code:66:11: error: redefinition of ‘const int N’
   66 | const int N = 20004, M = 200005;
      |           ^
answer.code:14:11: note: ‘const int N’ previously defined here
   14 | const int N = 20004, M = 200005;
      |           ^
answer.code:66:22: error: redefinition of ‘const int M’
   66 | const int N = 20004, M = 200005;
      |                      ^
answer.code:14:22: note: ‘const int M’ previously defined here
   14 | const int N = 20004, M = 200005;
      |                      ^
answer.code:67:8: error: redefinition of ‘struct Eg’
   67 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |        ^~
answer.code:15:8: note: previous definition of ‘struct Eg’
   15 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |        ^~
answer.code:67:27: error: conflicting declaration ‘int eg [200005]’
   67 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                           ^~
answer.code:15:27: note: previous declaration as ‘Eg eg [200005]’
   15 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                           ^~
answer.code:67:38: error: redefinition of ‘int ptr’
   67 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                                      ^~~
answer.code:15:38: note: ‘int ptr’ previously defined here
   15 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                                      ^~~
answer.code:67:47: error: redefinition of ‘int tail [20004]’
   67 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                                               ^~~~
answer.code:15:47: note: ‘int tail [20004]’ previously declared here
   15 | struct Eg { int v, pre; } eg[M]; int ptr = 1, tail[N];
      |                                               ^~~~
answer.code:68:6: error: redefinition of ‘void add(int, int)’
   68 | void add(int u, int v) {
      |      ^~~
answer.code:16:6: note: ‘void add(int, int)’ previously defined here
   16 | void add(int u, int v) {
      |      ^~~
answer.code:73:5: error: redefinition of ‘int dfn [20004]’
   73 | int dfn[N], low[N], cut[N], dfp;
      |     ^~~
answer.code:21:5: note: ‘int dfn [20004]’ previously declared here
   21 | int dfn[N], low[N], cut[N], dfp;
      |     ^~~
answer.code:73:13: error: redefinition of ‘int low [20004]’
   73 | int dfn[N], low[N], cut[N], dfp;
      |             ^~~
answer.code:21:13: note: ‘int low [20004]’ previously declared here
   21 | int dfn[N], low[N], cut[N], dfp;
      |             ^~~
answer.code:73:21: error: redefinition of ‘int cut [20004]’
   73 | int dfn[N], low[N], cut[N], dfp;
      |                     ^~~
answer.code:21:21: note: ‘int cut [20004]’ previously declared here
   21 | int dfn[N], low[N], cut[N], dfp;
      |                     ^~~
answer.code:73:29: error: redefinition of ‘int dfp’
   73 | int dfn[N], low[N], cut[N], dfp;
      |                             ^~~
answer.code:21:29: note: ‘int dfp’ previously declared here
   21 ...