답안 #244512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244512 2020-07-04T08:24:26 Z dwsc Pipes (CEOI15_pipes) C++14
50 / 100
1308 ms 13692 KB
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<short> adj[30010];
int low[30010],num[30010],parent[30010];
int counter;
void articulationPoint(int u){
   // cout << u;
    low[u] = num[u] = counter++;
    int parentcount = 0;
    for (int j = 0; j < adj[u].size(); j++){
        int v = adj[u][j];
        if (num[v] == -1){
            parent[v] = u;
            articulationPoint(v);
            if (low[v] > num[u]) cout << u << " " << v << "\n";
            low[u] = min(low[u],low[v]);
        }
        else if (v != parent[u]){
            low[u] = min(low[u],low[v]);
        }
        else if (v == parent[u]){
            parentcount++;
            if (parentcount > 1) low[u] = min(low[u],low[v]);
        }
    }
}

int main(){
    cin >> n >> m;
    for (int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    for (int i = 1; i <= n; i++){
        num[i] = -1;
    }
    for (int i = 1;i <= n; i++) if (num[i] == -1) articulationPoint(i);
}

Compilation message

pipes.cpp: In function 'void articulationPoint(int)':
pipes.cpp:11:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j = 0; j < adj[u].size(); j++){
                     ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Correct 5 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 1664 KB Output is correct
2 Correct 14 ms 1280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 448 ms 5368 KB Output is correct
2 Correct 424 ms 4856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 784 ms 7548 KB Output is correct
2 Correct 928 ms 9552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1308 ms 13692 KB Output is correct
2 Correct 1101 ms 11796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 1920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1920 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -