답안 #911692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
911692 2024-01-19T04:44:30 Z Sir_Ahmed_Imran 낙하산 고리들 (IOI12_rings) C++17
컴파일 오류
0 ms 0 KB
                              ///~~~LOTA~~~///
#include "rings.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define MAXN 1000001
int n,x;
int e[MAXN];
int par[MAXN];
int vis[MAXN];
vector<int> a[MAXN];
void dfs(int v,int u,vector<int>& vec){
    vis[v]=1;
    vec.append(v);
    for(auto& i:a[v])
        if(!vis[i])
            dfs(i,u,vec);
    if(vec.back()!=u) vec.pop_back();
}
int root(int v){
    if(par[v]==v) return v;
    par[v]=root(par[v]);
    return par[v];
}
void join(int v,int u){
    par[root(u)]=root(v);
}
bool same(int v,int u){
    return (root(v)==root(u));
}
void Init(int u){
    n=x=u;
    for(int i=0;i<n;i++){
        par[i]=i; 
        e[i]=1;
    }
}
void Link(int v, int u){
    if(!x) return;
    if(a[v].size()==2 && a[u].size()==2){
        for(int i=0;i<n;i++)
            if(i!=v && i!=u) 
                e[i]=0;
        x=e[v]+e[u];
        join(v,u);
        a[v].append(u);
        a[u].append(v);
    }
    else if(a[v].size()==3 || a[u].size()==3){
        if(a[v].size()!=3) swap(v,u);
        for(int i=0;i<n;i++)
            if(i!=v) e[i]=0;
        x=e[v];
        join(v,u);
        a[v].append(u);
        a[u].append(v);
    }
    else if(a[v].size()==2 || a[u].size()==2){
        if(a[v].size()!=2) swap(v,u);
        map<int,int> z;
        a[v].append(u);
        a[u].append(v);
        join(v,u);
        z[v]=1;
        for(auto& i:a[v]) z[i]=1;
        for(int i=0;i<n;i++)
            if(!z[i])
                e[i]=0;
        x=0;
        for(auto& i:z)
            x+=e[i.ff];
    }
    else if(a[v].size()==1 && a[u].size()==1 && same(v,u)){
        vector<int> vec;
        for(int i=0;i<n;i++) vis[i]=0;
        dfs(v,u,vec);
        map<int,int> z;
        a[v].append(u);
        a[u].append(v);
        join(v,u);
        for(auto& i:vec)
            z[i]=1;
        for(int i=x=0;i<n;i++)
            if(!z[i])
                e[i]=0;
        for(auto& i:z)
            x+=e[i.ff];
    }
    else{
        a[v].append(u);
        a[u].append(v);
        join(v,u);
    }
}
int CountCritical(){
    return x;;
}

Compilation message

rings.cpp:2:10: fatal error: rings.h: No such file or directory
    2 | #include "rings.h"
      |          ^~~~~~~~~
compilation terminated.