QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#340615 | #995. 桥 | FISHER_# | WA | 92ms | 16940kb | C++14 | 873b | 2024-02-29 10:43:45 | 2024-02-29 10:43:46 |
Judging History
answer
#include <bits/stdc++.h>
#define PB push_back
#define EB emplace_back
using namespace std;
const int maxn = 100000;
vector<int> e;
vector<int> g[maxn + 5];
int dfn[maxn + 5], low[maxn + 5], stamp;
int A[2 * maxn + 5], B[2 * maxn + 5];
void tarjan(int u, int fa) {
dfn[u] = low[u] = ++stamp;
for (int eid : g[u])
if (eid != fa) {
int v = e[eid];
if (!dfn[v]) {
tarjan(v, eid ^ 1);
low[u] = min(low[u], low[v]);
} else low[u] = min(low[u], dfn[v]);
if (low[v] > dfn[u]) A[eid] = u, B[eid] = v;
}
}
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= m; i++) {
int u, v;
scanf("%d%d", &u, &v);
g[u].PB(e.size()), e.PB(v);
g[v].PB(e.size()), e.PB(u);
}
for (int i = 1; i <= n; i++)
if (!dfn[i]) tarjan(i, -1);
for (int i = 0; i < 2 * m; i++)
if (A[i]) printf("%d %d\n", A[i], B[i]);
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 92ms
memory: 16940kb
input:
24942 387166 12556 21443 22404 16376 11073 24296 1535 11968 23745 2818 5073 12731 22550 14761 24118 12008 22695 18979 15118 13639 2080 8721 692 22578 22581 15267 9278 4127 7457 21674 17693 23448 10949 23429 9700 6009 14140 5064 7742 15164 17336 1662 18903 9760 17645 19575 6540 11942 11 4937 15282 10...
output:
24942 0 1 0 2 0 1 0 172 0 1 0 2 0 1 0 2 0 1 0 1 0 1 0 1 0 1 0 142 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 182 0 1 0 944 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 993 0 1 0 621 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 6 0 1 0 1 0 1 0 1 0 1 0 ...
result:
wrong output format Extra information in the output file