QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#377829#5506. Hyperloopckiseki#WA 0ms3616kbC++201.5kb2024-04-05 18:29:562024-04-05 18:29:56

Judging History

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

  • [2024-04-05 18:29:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-04-05 18:29:56]
  • 提交

answer

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

#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(auto s, auto ...a) {
  cerr << "\e[1;32m(" << s << ") = (";
  int f = 0;
  (..., (cerr << (f++ ? ", " : "") << a));
  cerr << ")\e[0m\n";
}
#include <experimental/iterator>
void orange_(auto s, auto L, auto R) {
  cerr << "\e[1;33m[ " << s << " ] = [ ";
  using namespace experimental;
  copy(L, R, make_ostream_joiner(cerr, ", "));
  cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif

class SCC {
protected:
  int n, dfc, nscc;
  vector<vector<int>> G;
  vector<int> vis, low, idx, stk;
  void dfs(int i) {
    vis[i] = low[i] = ++dfc;
    stk.push_back(i);
    for (int j : G[i])
      if (!vis[j])
        dfs(j), low[i] = min(low[i], low[j]);
      else if (vis[j] != -1)
        low[i] = min(low[i], vis[j]);
    if (low[i] == vis[i])
      for (idx[i] = nscc++; vis[i] != -1;) {
        int x = stk.back();
        stk.pop_back();
        idx[x] = idx[i]; vis[x] = -1;
      }
  }
public:
  SCC(int n_) : n(n_), dfc(0), nscc(0), G(n), vis(n), low(n), idx(n) {}
  void add_edge(int u, int v) { G[u].push_back(v); }
  void solve() {
    for (int i = 0 ; i < n; ++i) if (!vis[i]) dfs(i);
  }
  int get_id(int x) { return idx[x]; }
  int count() { return nscc; }
};

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3616kb

input:

2
4 6
1 2 1
1 3 2
2 3 1
2 4 2
3 4 1
1 4 4
6 11
1 2 9
2 3 12
3 4 3
4 5 5
5 6 10
6 1 22
2 4 9
3 6 1
4 6 5
2 5 2
3 5 8

output:


result:

wrong output format Unexpected end of file - int32 expected (test case 1)