Submission #623832

# Submission time Handle Problem Language Result Execution time Memory
623832 2022-08-06T15:23:27 Z Iwanttobreakfree Pipes (CEOI15_pipes) C++17
10 / 100
3517 ms 65536 KB
#include <iostream>
#include <vector>
using namespace std;
#define pii pair<int,int>
vector<pii> ans;
int timer=0;
int dfs(int a,int par,vector<vector<int>>& g,vector<int>& min_in,vector<int>& t){
    t[a]=timer++;
    min_in[a]=t[a];
    for(int x:g[a]){
        if(x==par)continue;
        if(t[x]==-1){
            int up=dfs(x,a,g,min_in,t);
            if(up>t[a])ans.push_back({a+1,x+1});

        }
        min_in[a]=min(min_in[a],min_in[x]);
    }
    //cout<<a<<' '<<min_in[a]<<' '<<t[a]<<'\n';
    return min_in[a];
}
int main(){
    int n,m,x,y;
    cin>>n>>m;
    vector<vector<int>> g(n,vector<int>());
    vector<int> t(n,-1),min_in(n);
    while(m--){
        cin>>x>>y;
        x--;y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for(int i=0;i<n;i++)if(t[i]==-1)dfs(i,i,g,min_in,t);
    //cout<<endl;
    for(auto x:ans)cout<<x.first<<' '<<x.second<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1108 KB Output is correct
2 Incorrect 7 ms 724 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 277 ms 14096 KB Output is correct
2 Correct 268 ms 13232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 497 ms 22044 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 828 ms 40340 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1257 ms 53384 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1894 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2513 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3172 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3517 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -