Submission #244451

# Submission time Handle Problem Language Result Execution time Memory
244451 2020-07-04T06:19:37 Z dantoh000 Pipes (CEOI15_pipes) C++14
10 / 100
2679 ms 65540 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int n,m;
vector<int> G[100005];
int num[100005];
int p[100005];
int low[100005];
int ct = 1;
int root;
map< ii , int> M;
void dfs(int u){
    low[u] = num[u] = ct++;
    for (auto v : G[u]){
        if (num[v] == 0){
            p[v] = u;
            dfs(v);
            if (low[v] > num[u]){
                M[ii(u,v)]++;
            }
            low[u] = min(low[u],low[v]);
        }
        else if (v != p[u]){
            low[u] = min(low[u],num[v]);
        }
    }
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i = 0; i < m; i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for (int i = 1; i <= n; i++){
        if (num[i] == 0){
            dfs(i);
        }
    }
    for (auto x : M){
        if (x.second == 1){
            printf("%d %d\n",x.first.first,x.first.second);
        }
    }
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
pipes.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&u,&v);
         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2688 KB Output is correct
2 Incorrect 6 ms 2688 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 10 ms 3200 KB Output is correct
2 Incorrect 10 ms 2944 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 175 ms 10744 KB Output is correct
2 Correct 170 ms 10188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 314 ms 14328 KB Output is correct
2 Runtime error 384 ms 25268 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 573 ms 25416 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 908 ms 31596 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 1499 ms 53496 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 1948 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2489 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2679 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -