QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#792318 | #995. 桥 | caijianhong | Compile Error | / | / | C++23 | 1.0kb | 2024-11-29 09:01:47 | 2024-11-29 09:01:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) fprintf(stderr, ##__VA_ARGS__)
#else
#define endl "\n"
#define debug(...) void(0)
#endif
using LL = long long;
constexpr int N = 1e5 + 10;
int n, m;
basic_string<pair<int, int>> g[N];
pair<int, int> edges[500010];
int dfn[N], low[N], stk[N], top, cnt, ecc;
bool vis[500010];
void tarjan(int u, int fi) {
dfn[u] = low[u] = ++cnt;
for (auto e : g[u]) {
int v = e.first, id = e.second;
if (id == fi) continue;
if (!dfn[v]) {
tarjan(v, id), low[u] = min(low[u], low[v]);
if (low[v] > dfn[u]) vis[id] = true;
} else low[u] = min(low[u], dfn[v]);
}
}
int main() {
#ifndef LOCAL
cin.tie(nullptr)->sync_with_stdio(false);
#endif
cin >> n >> m;
for (int i = 1, u, v; i <= m; i++) cin >> u >> v, g[u] += {v, i}, g[v] += {u, i}, edges[i] = {u, v};
for (int i = 1; i <= n; i++) if (!dfn[i]) tarjan(i, 0);
for (int i = 1; i <= m; i++) if (vis[i]) cout << edges[i].first << " " << edges[i].second << endl;
return 0;
}
詳細信息
In file included from /usr/include/c++/13/bits/basic_string.h:47, from /usr/include/c++/13/string:54, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/c++/13/string_view: In instantiation of ‘class std::basic_string_view<std::pair<int, int>, std::char_traits<std::pair<int, int> > >’: /usr/include/c++/13/bits/basic_string.h:165:12: required from ‘struct std::__cxx11::basic_string<std::pair<int, int> >::__sv_wrapper’ answer.code:32:66: required from here /usr/include/c++/13/string_view:109:21: error: static assertion failed 109 | static_assert(is_trivial_v<_CharT> && is_standard_layout_v<_CharT>); | ^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/string_view:109:21: note: ‘std::is_trivial_v<std::pair<int, int> >’ evaluates to false