Submission #519124

# Submission time Handle Problem Language Result Execution time Memory
519124 2022-01-25T17:19:53 Z LucaIlie Connecting Supertrees (IOI20_supertrees) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include "grader.h"
 
#define MAX_N 1000
 
using namespace std;
 
struct dsu {
    int n;
    int sef[MAX_N];
 
    void init( int x ) {
        int i;
 
        n = x;
        for ( i = 0; i < n; i++ )
            sef[i] = i;
    }
 
    int find( int x ) {
        if ( sef[x] != x )
            sef[x] = find( sef[x] );
        return sef[x];
    }
 
    void unionn( int x, int y ) {
        x = find( x );
        y = find( y );
        sef[y] = x;
    }
};
 
int construct( vector <vector <int>> p ) {
    int n, a, x, y, i, j;
    dsu forest;
    vector <int> f[MAX_N];
 
    n = p.size();
    vector <vector <int>> b( n );
    forest.init( n );
 
 
    for ( x = 0; x < n; x++ ) {
        for ( y = 0; y < n; y++ ) {
            if ( p[x][y] > 0 )
                forest.unionn( x, y );
        }
    }
 
    for ( x = 0; x < n; x++ )
        f[forest.find( x )].push_back( x );
 
    for ( i = 0; i < n; i++ ) {
        for ( j = 0; j < n; j++ )
            b[i].push_back( 0 );
    }
    for ( x = 0; x < n; x++ ) {
        if ( f[x].size() ) {
            a = p[f[x][0]][f[x][0]];
            for ( i = 0; i < f[x].size(); i++ ) {
                for ( j = 0; j < f[x].size(); j++ ) {
                    if ( a != p[f[x][i]][f[x][j]] )
                        return 0;
                }
            }
            for ( i = 0; i < f[x].size() - 1; i++ ) {
                b[f[x][i]][f[x][i + 1]] = 1;
                b[f[x][i + 1]][f[x][i]] = 1;
            }
            if ( f[x].size() < a )
                return 0;
            for ( i = 1; i < a; i++ ) {
                b[f[x][0]][f[x][i]] = 1;
                b[f[x][i]][f[x][0]] = 1;
            }
        }
    }
 
    build( b );
 
    return 1;
}

Compilation message

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