이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> depth;
vector<int> low;
vector<vector<int> > AL;
void AP(int i, int d, int pa) {
int cc = 0;
depth[i] = d; low[i] = d;
bool art = false;
for (int ch : AL[i]) {
if (ch==pa) continue;
if (depth[ch] > -1) {
low[i] = min(low[i], depth[ch]);
} else {
AP(ch, d+1, i);
cc++;
if (low[ch] >= depth[i]) {
art = true;
}
low[i] = min(low[i], low[ch]);
}
}
if (low[i] == depth[i] && pa!=-1) {
cout << i+1 << " " << pa+1 << "\n";
}
}
int main() {
int N, M, a, b; cin >> N >> M;
depth.assign(N, -1);
low.assign(N, 0);
AL.assign(N, vector<int>());
for (int i = 0; i < M; i++) {
cin >> a >> b; a--;b--;
AL[a].push_back(b); AL[b].push_back(a);
}
for (int i = 0; i < N; i++) {
if (depth[i] == -1) AP(i,0,-1);
}
}
컴파일 시 표준 에러 (stderr) 메시지
pipes.cpp: In function 'void AP(int, int, int)':
pipes.cpp:11:10: warning: variable 'art' set but not used [-Wunused-but-set-variable]
11 | bool art = false;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |