Submission #83101

# Submission time Handle Problem Language Result Execution time Memory
83101 2018-11-05T10:45:32 Z vex Friend (IOI14_friend) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define maxn 100005
#define pii pair<int,int>
#define h first
#define p second
using namespace std;

int n,br;
int c[maxn];
int idx[maxn];
vector<int>adj[maxn];
int h[maxn],p[maxn];

/**
0 - IAmYourFriend
1 - MyFriendsAreYourFriends
2 - WeAreYourFriends
**/

int sz[maxn];
int p[maxn];
int build()
{
    for(int i=0;i<n;i++)
    {
        sz[i]=1;
        p[i]=i;
    }
}
int par(int x)
{
    if(x!=p[x])return p[x]=par(p[x]);
    return x;
} 
void unite(int x,int y)
{
    x=par(x);
    y=par(y);
    if(x==y)return;
    
    if(sz[x]<sz[y])swap(x,y);
    sz[x]+=sz[y];
    p[y]=x;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
    
    cin>>n;
    for(int i=0;i<n;i++)cin>>c[i];
    for(int i=0;i<n;i++)cin>>h[i]>>p[i];
    build();
    
    for(int i=n-1;i>=0;i--)
    {
        if(p[i]==0)
        {
            adj[i].push_back(h[i]);
            adj[h[i]].push_back(i);
        }
        else if(p[i]==1)
        {
            
        }
        else
        {
            
        }
    }
    return 0;
}

Compilation message

friend.cpp:21:11: error: redefinition of 'int second [100005]'
 int p[maxn];
           ^
friend.cpp:5:11: note: 'int second [100005]' previously declared here
 #define p second
           ^
friend.cpp:12:13: note: in expansion of macro 'p'
 int h[maxn],p[maxn];
             ^
friend.cpp: In function 'int build()':
friend.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^