QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#34740#4251. Gamelunchbox#Compile Error//C++171.4kb2022-06-12 06:34:562024-05-26 00:52:49

Judging History

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

  • [2024-05-26 00:52:49]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-12 06:34:56]
  • 提交

answer

#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

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

const int N = 30000;

template<int N> struct scc {
  int time, scc[N], id[N], low[N];
  int color = 0;
  vector<int> adj[N], stack, sccs;
 
  void init() {
    #define mem(a, x) memset(a, x, sizeof(a))
    mem(scc, -1), mem(id, 0), mem(low, 0);
    stack.clear(), sccs.clear();
    time = 0, color = 0;
    #undef mem
  }
  
  void add_edge(int x, int y) {
    adj[x].push_back(y);
  }
 
  int search(int x) {
    low[x] = id[x] = ++time;
    stack.push_back(x);
    for (int y : adj[x]) if (scc[y] == -1) {
      low[x] = min(low[x], id[y] ?: search(y));
    }
    if (low[x] == id[x]) {
      sccs.push_back(++color);
      for (int y = -1; y != x;) {
        scc[y = stack.back()] = color;
        stack.pop_back();
      }
    }
    return low[x];
  }
 
  void tarjan(int n) {
    for (int i = 0; i < n; ++i)
      if (!id[i]) search(i);
    reverse(begin(sccs), end(sccs));
  }
};

scc<N> g;
int n, k;

void init(int n_, int k_) {
  g.init();
  n = n_, k = k_;
  for (int i = 0; i < k - 1; i++)
    g.add_edge(i, i + 1);
}

int add_teleporter(int u, int v) {
  g.add_edge(u, v);
  g.init(), g.tarjan(n);
  vector<int> kk(g.color + 69);
  for (int i = 0; i < n; i++)
    kk[g.scc[i]]++;
  for (int i = 0; i < k - 1; i++)
    if (kk[g.scc[i]] > 1)
      return 1;
  return 0;
}

详细

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:5:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~