Submission #443414

# Submission time Handle Problem Language Result Execution time Memory
443414 2021-07-10T13:06:06 Z leinad2 Fountain Parks (IOI21_parks) C++17
Compilation error
0 ms 0 KB
//#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
int par[200010], A[3][100010];
int Find(int v){return v==par[v]?v:par[v]=Find(par[v]);}
int construct_roads(vector<int>x, vector<int>y)
{
    int n, i, j, k;n=x.size();
    for(i=0;i<n;i++)par[i]=i;
    for(i=0;i<n;i++)A[x[i]/2][y[i]/2]=i+1;
    vector<int>u, v, a, b;
    for(i=1;i<=2;i++)
    {
        for(j=1;j<=99999;j++)
        {
            if(A[i][j]&&A[i][j+1])
            {
                int x=A[i][j]-1;int y=A[i][j+1]-1;
                u.push_back(x);
                v.push_back(y);
                a.push_back(4*i-3);
                b.push_back(2*j+1);
                par[Find(x)]=Find(y);
            }
        }
    }
    for(j=1;j<=99999;j++)
    {
        if(A[1][j]&&A[2][j])
        {
            int x=A[1][j]-1;int y=A[2][j]-1;
            u.push_back(x);
            v.push_back(y);
            a.push_back(3);
            b.push_back(2*j+1);
            par[Find(x)]=Find(y);
        }
    }
    for(i=1;i<n;i++)if(Find(i)!=Find(0))return 0;
    build(u, v, a, b);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:40:5: error: 'build' was not declared in this scope
   40 |     build(u, v, a, b);
      |     ^~~~~
parks.cpp:8:18: warning: unused variable 'k' [-Wunused-variable]
    8 |     int n, i, j, k;n=x.size();
      |                  ^