Submission #291738

# Submission time Handle Problem Language Result Execution time Memory
291738 2020-09-05T18:05:35 Z Badrangiikh Dreaming (IOI13_dreaming) C++14
Compilation error
0 ms 0 KB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

int ans , maxx , x , y ;
int pare [ 100000 ] ;
int a [ 100000 ] ;
pair < int , int > pr , prr , pp ;
vector < pair < int , int > > vc [ 100000 ] ;
vector < int > vec ;
bool used [ 100000 ] ;


pair < int , int > dfs ( int chi , int par ) {
    used [ chi ] = 1 ;
    prr = { 0 , chi } ;
    for( auto &u : vc [ chi ] ) {
        if ( u . ss == par ) continue;
        pp = dfs ( u . second , chi ) ;
        prr = max ( prr , { pp . first + u . first , pp . second } ) ;
    }
    a [ chi ] = prr . first ;
    pare [ chi ] = par ;
    return prr ; 
}
int travelTime (int N, int M, int L, int A[], int B[], int T[]) {
    for ( int i = 0 ; i < M ; i ++ ) {
        vc [ A [ i ] ] . push_back ( { T [ i ] , B [ i ] } ) ;
        vc [ B [ i ] ] . push_back ( { T [ i ] , A [ i ] } ) ;
    }
    vector<int> vec;
    int ans, diametr = 0;
    for ( int i = 0 ; i < N ; i ++ ) {
        if ( used [ i ] != 0 ) continue ;
        pr = dfs ( dfs ( i , -1 ) . second , -1 ) ;
        x = pr . second ;
        y = pr . first ;
        for ( int j = x ; j >= 0 ; j = pare [ j ] ) {
            y = min ( y , max ( a [ j ] , pr . first - a [ j ] ) ) ;
        }
        vec . push_back ( y ) ; 
        maxx = max ( maxx , pr. first ) ; 
    }
    sort ( vec . rbegin ( ) , vec . rend ( ) ) ;
    if ( vec . size ( ) > 2 ) {
        ans = L + vec [ 0 ] + vec [ 1 ] ;
        for ( int i = 2 ; i < vec . size ( ) ; i ++ ) {
            ans = max ( ans , L + L + vec [ 1 ] + vec [ i ] ) ;
        }
    }
    else {
        if ( vec . size ( ) == 2 ) ans = L + vec [ 0 ] + vec [ 1 ] ;
        else ans = 0 ;
    }
    ans = max ( ans , maxx ) ;
    return ans ;
}

Compilation message

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