Submission #405344

# Submission time Handle Problem Language Result Execution time Memory
405344 2021-05-16T09:17:43 Z MeGustaElArroz23 Potemkin cycle (CEOI15_indcyc) C++14
20 / 100
1000 ms 2232 KB
#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;

int main(){
    int n,m;
    cin >> n >> m;
    vvi conexiones(n);
    for (int i=0;i<m;i++){
        int a,b;
        cin >> a >>b;
        a--;
        b--;
        conexiones[a].push_back(b);
        conexiones[b].push_back(a);
    }
    for (int i=0;i<n;i++){
        for (int x:conexiones[i]){
            bool T=false;
            if (x<i) continue;
            vector<bool> porvisitar(n,true);
            porvisitar[i]=false;
            queue<int> cola;
            for (int y:conexiones[i]){
                if (y!=x or T) cola.push(y);
                else T=true;
            }
            while (cola.size()){
                int y=cola.front();
                cola.pop();
                if (porvisitar[y]){
                    porvisitar[y]=false;
                    for (int z:conexiones[y]) cola.push(z);
                }
            }
            if (porvisitar[x]) cout << i+1 << ' '<<x+1<<'\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Too short sequence
2 Incorrect 1 ms 204 KB Wrong answer on graph without induced cycle
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Too short sequence
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Too short sequence
2 Incorrect 1 ms 204 KB Unexpected end of file - token expected
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Too short sequence
# Verdict Execution time Memory Grader output
1 Correct 13 ms 204 KB Too short sequence
2 Incorrect 13 ms 204 KB Unexpected end of file - token expected
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 332 KB Wrong answer on graph without induced cycle
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 332 KB Too short sequence
2 Incorrect 121 ms 332 KB Unexpected end of file - token expected
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 1032 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 2232 KB Time limit exceeded
2 Halted 0 ms 0 KB -