Submission #244503

# Submission time Handle Problem Language Result Execution time Memory
244503 2020-07-04T07:49:49 Z dwsc Pipes (CEOI15_pipes) C++14
30 / 100
1456 ms 23456 KB
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> 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++){
                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Correct 5 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1536 KB Output is correct
2 Correct 14 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 435 ms 9112 KB Output is correct
2 Correct 430 ms 8568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 783 ms 12536 KB Output is correct
2 Runtime error 911 ms 17144 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 1456 ms 23456 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -