QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130294#995. 桥KHIN#Compile Error//C++142.7kb2023-07-23 20:00:042023-07-23 20:00:07

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-23 20:00:07]
  • 评测
  • [2023-07-23 20:00:04]
  • 提交

answer

# include <bits/stdc++.h>

using namespace std;

namespace khin {
  auto& cin(std::cin);
  auto& cout(std::cout);
  constexpr int N(100'005);
  constexpr int M(500'005);
  struct edge {
    int x, y;
    bool b;
    int end(int z) const
    { return x ^ y ^ z; }
  };
  struct vertex {
    vector<int> inc;
    int dep, low;
  };
  int n, m;
  vertex v[N];
  edge e[M];
  void se(int x, int fr) {
    if (!fr) v[x].low = v[x].dep = 1;
    else v[x].low = v[x].dep = v[e[fr].end(x)].dep + 1;
    for (int const i : v[x].inc) if (i != fr) {
      if (v[e[i].end(x)].dep)
        v[x].low = min(v[x].low, v[e[i].end(x)].dep);
      else {
        se(e[i].end(x), i);
        v[x].low = min(v[x].low, v[e[i].end(x)].low);
      }
    }
    // cerr << x << ' ' << v[x].low << ' ' << v[x].dep << endl;
    if (fr && v[x].low == v[x].dep) e[fr].b = true;
    if (fr) v[x].low = min(v[x].low, v[e[fr].end(x)].dep);
  }
  void main() {
    cin >> n >> m;
    for (int i(1); i <= m; ++i) {
      cin >> e[i].x >> e[i].y;
      v[e[i].x].inc.push_back(i);
      v[e[i].y].inc.push_back(i);
    }
    se(1, 0);
    for (int i(1); i <= m; ++i) if (e[i].b)
      cout << e[i].x << ' ' << e[i].y << '\n';
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  khin::cin.tie(nullptr);
  khin::cout.tie(nullptr);
  khin::main();
}# include <bits/stdc++.h>

using namespace std;

namespace khin {
  auto& cin(std::cin);
  auto& cout(std::cout);
  constexpr int N(100'005);
  constexpr int M(500'005);
  struct edge {
    int x, y;
    bool b;
    int end(int z) const
    { return x ^ y ^ z; }
  };
  struct vertex {
    vector<int> inc;
    int dep, low;
  };
  int n, m;
  vertex v[N];
  edge e[M];
  void se(int x, int fr) {
    if (!fr) v[x].low = v[x].dep = 1;
    else v[x].low = v[x].dep = v[e[fr].end(x)].dep + 1;
    for (int const i : v[x].inc) if (i != fr) {
      if (v[e[i].end(x)].dep)
        v[x].low = min(v[x].low, v[e[i].end(x)].dep);
      else {
        se(e[i].end(x), i);
        v[x].low = min(v[x].low, v[e[i].end(x)].low);
      }
    }
    // cerr << x << ' ' << v[x].low << ' ' << v[x].dep << endl;
    if (v[x].low == v[x].dep) e[fr].b = true;
    if (fr) v[x].low = min(v[x].low, e[fr].end(x));
  }
  void main() {
    cin >> n >> m;
    for (int i(1); i <= m; ++i) {
      cin >> e[i].x >> e[i].y;
      v[e[i].x].inc.push_back(i);
      v[e[i].y].inc.push_back(i);
    }
    se(1, 0);
    for (int i(1); i <= m; ++i) if (e[i].b)
      cout << e[i].x << ' ' << e[i].y << '\n';
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  khin::cin.tie(nullptr);
  khin::cout.tie(nullptr);
  khin::main();
}

Details

answer.code:56:2: error: stray ‘#’ in program
   56 | }# include <bits/stdc++.h>
      |  ^
answer.code:56:4: error: ‘include’ does not name a type
   56 | }# include <bits/stdc++.h>
      |    ^~~~~~~
answer.code:61:9: error: conflicting declaration ‘auto& khin::cin’
   61 |   auto& cin(std::cin);
      |         ^~~
answer.code:6:9: note: previous declaration as ‘std::basic_istream<char>& khin::cin’
    6 |   auto& cin(std::cin);
      |         ^~~
answer.code:62:9: error: conflicting declaration ‘auto& khin::cout’
   62 |   auto& cout(std::cout);
      |         ^~~~
answer.code:7:9: note: previous declaration as ‘std::basic_ostream<char>& khin::cout’
    7 |   auto& cout(std::cout);
      |         ^~~~
answer.code:63:17: error: redefinition of ‘constexpr const int khin::N’
   63 |   constexpr int N(100'005);
      |                 ^
answer.code:8:17: note: ‘constexpr const int khin::N’ previously defined here
    8 |   constexpr int N(100'005);
      |                 ^
answer.code:64:17: error: redefinition of ‘constexpr const int khin::M’
   64 |   constexpr int M(500'005);
      |                 ^
answer.code:9:17: note: ‘constexpr const int khin::M’ previously defined here
    9 |   constexpr int M(500'005);
      |                 ^
answer.code:65:10: error: redefinition of ‘struct khin::edge’
   65 |   struct edge {
      |          ^~~~
answer.code:10:10: note: previous definition of ‘struct khin::edge’
   10 |   struct edge {
      |          ^~~~
answer.code:71:10: error: redefinition of ‘struct khin::vertex’
   71 |   struct vertex {
      |          ^~~~~~
answer.code:16:10: note: previous definition of ‘struct khin::vertex’
   16 |   struct vertex {
      |          ^~~~~~
answer.code:75:7: error: redefinition of ‘int khin::n’
   75 |   int n, m;
      |       ^
answer.code:20:7: note: ‘int khin::n’ previously declared here
   20 |   int n, m;
      |       ^
answer.code:75:10: error: redefinition of ‘int khin::m’
   75 |   int n, m;
      |          ^
answer.code:20:10: note: ‘int khin::m’ previously declared here
   20 |   int n, m;
      |          ^
answer.code:76:10: error: redefinition of ‘khin::vertex khin::v [100005]’
   76 |   vertex v[N];
      |          ^
answer.code:21:10: note: ‘khin::vertex khin::v [100005]’ previously declared here
   21 |   vertex v[N];
      |          ^
answer.code:77:8: error: redefinition of ‘khin::edge khin::e [500005]’
   77 |   edge e[M];
      |        ^
answer.code:22:8: note: ‘khin::edge khin::e [500005]’ previously declared here
   22 |   edge e[M];
      |        ^
answer.code:78:8: error: redefinition of ‘void khin::se(int, int)’
   78 |   void se(int x, int fr) {
      |        ^~
answer.code:23:8: note: ‘void khin::se(int, int)’ previously defined here
   23 |   void se(int x, int fr) {
      |        ^~
answer.code:93:8: error: redefinition of ‘void khin::main()’
   93 |   void main() {
      |        ^~~~
answer.code:38:8: note: ‘void khin::main()’ previously defined here
   38 |   void main() {
      |        ^~~~
answer.code:106:5: error: redefinition of ‘int main()’
  106 | int main() {
      |     ^~~~
answer.code:51:5: note: ‘int main()’ previously defined here
   51 | int main() {
      |     ^~~~