답안 #115008

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115008 2019-06-04T11:29:10 Z oolimry One-Way Streets (CEOI17_oneway) C++14
0 / 100
5 ms 4992 KB
#include <bits/stdc++.h>

using namespace std;


struct node{
    int depth;
    bool vis = false;
    int low;
    int p;
    int up = 0; ///0 - undecided, 1 - up to parent, 2 - down to child
    vector<int> adj;
};


node g1[100005];
typedef pair<int,int> ii;
set<ii> bridges;
void dfs(int u){
    if(g1[u].vis) return;
    g1[u].low = g1[u].depth;
    g1[u].vis = true;
    for(int i = 0;i < g1[u].adj.size();i++){
        int v = g1[u].adj[i];
        if(!g1[v].vis){
            g1[v].depth = g1[u].depth + 1;
            g1[v].p = u;
            dfs(v);
            g1[u].low = min(g1[v].low,g1[u].low);

            if(g1[v].low > g1[u].depth){
                bridges.insert(ii(u,v));
                bridges.insert(ii(v,u));
            }
        }
        else if(g1[u].p != v){
            g1[u].low = min(g1[u].low, g1[v].depth);
        }
    }
}

class UFDS{
public:
    vector<int> rak;
    vector<int> p;
    int n;

    void create(int nn){
        n = nn;
        for(int i = 0;i < n;i++){
            rak.push_back(0);
            p.push_back(i);
        }
    }

    int findSet(int i){
        if(i == p[i]) return i;
        else{
            p[i] = findSet(p[i]);
            return p[i];
        }
    }

    void unionSet(int a, int b){
        int x = findSet(a);
        int y = findSet(b);
        if(x == y) return;
        if(rak[x] < rak[y]){
            p[x] = y;
        }
        else{
            p[y] = x;
            if(rak[x] == rak[y]) rak[x]++;
        }
    }
};
set<ii> nondupl;
set<ii> duplicates;
vector<pair<ii, int> > edgeIndex;


vector<node> tree;

void root(int u){
    if(tree[u].vis) return;
    tree[u].vis = true;
    for(int i = 0;i < tree[u].adj.size();i++){
        int v = tree[u].adj[i];
        if(tree[v].vis) continue;
        tree[v].depth = tree[u].depth + 1;
        tree[v].p = u;
        root(v);
    }
}

int main()
{
    //freopen("i.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cout << "BBRBBL";
}

Compilation message

oneway.cpp: In function 'void dfs(int)':
oneway.cpp:23:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i < g1[u].adj.size();i++){
                   ~~^~~~~~~~~~~~~~~~~~
oneway.cpp: In function 'void root(int)':
oneway.cpp:87:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i < tree[u].adj.size();i++){
                   ~~^~~~~~~~~~~~~~~~~~~~
oneway.cpp: In function 'int main()':
oneway.cpp:101:9: warning: unused variable 'n' [-Wunused-variable]
     int n, m;
         ^
oneway.cpp:101:12: warning: unused variable 'm' [-Wunused-variable]
     int n, m;
            ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -