Submission #244513

# Submission time Handle Problem Language Result Execution time Memory
244513 2020-07-04T08:31:10 Z dantoh000 Pipes (CEOI15_pipes) C++14
30 / 100
499 ms 24700 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int n,m;
bitset<10005> M[10005];
bitset<10005> G[10005];
int num[10005];
int p[10005];
int low[10005];
int ct = 1;
void dfs(int u){
    low[u] = num[u] = ct++;
    for (int v = 1; v <= n; v++){
        if (G[u][v]){
            if (num[v] == 0){
                p[v] = u;
                dfs(v);
                if (low[v] > num[u]){
                    if (M[u][v] == 0){
                        printf("%d %d\n",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);
        if (G[u][v]){
            M[u][v] = M[v][u] = 1;
        }
        else{
            G[u][v] = G[v][u] = 1;
        }
    }
    for (int i = 1; i <= n; i++){
        if (num[i] == 0){
            dfs(i);
        }
    }
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:32: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:35: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 5 ms 512 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 6272 KB Output is correct
2 Correct 27 ms 6144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 203 ms 9336 KB Output is correct
2 Correct 218 ms 8824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 499 ms 24700 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 640 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 512 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 512 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 384 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 384 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 564 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -