Submission #911799

# Submission time Handle Problem Language Result Execution time Memory
911799 2024-01-19T05:25:19 Z Sir_Ahmed_Imran Parachute rings (IOI12_rings) C++17
Compilation error
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 f[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){
    v=root(v);
    u=root(u);
    par[u]=v;
    f[v]+=f[u];
}
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(!f[root(v)] && same(v,u)){
        vector<int> vec;
        for(int i=0;i<n;i++) vis[i]=0;
        dfs(v,u,vec);
        map<int,int> z;
        for(auto& i:vec) z[i]=1;
        for(int i=x=0;i<n;i++){
            if(!z[i]) e[i]=0;
            x+=e[i];
        }
    }
    a[v].append(u);
    a[u].append(v);
    join(v,u);
    if(a[v].size()>3){
        for(int i=0;i<n;i++)
            if(i!=v) e[i]=0;
        x=e[v];
    }
    if(a[u].size()>3){
        for(int i=0;i<n;i++)
            if(i!=u) e[i]=0;
        x=e[u];
    }
    if(a[v].size()==3){
        map<int,int> z;
        z[v]=1;
        for(auto& i:a[v]) z[i]=1;
        for(int i=x=0;i<n;i++){
            if(!z[i]) e[i]=0;
            x+=e[i];
        }
    }
    if(a[u].size()==3){
        map<int,int> z;
        z[u]=1;
        for(auto& i:a[u]) z[i]=1;
        for(int i=x=0;i<n;i++){
            if(!z[i]) e[i]=0;
            x+=e[i];
        }
    }
}
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.