Submission #962075

# Submission time Handle Problem Language Result Execution time Memory
962075 2024-04-13T06:41:12 Z Ice_man Dreaming (IOI13_dreaming) C++14
Compilation error
0 ms 0 KB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include"dreaming.h"
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>

#define maxn 2000005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cerr<<"passed"<<endl;

#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")

using namespace std;

/**std::chrono::high_resolution_clock::time_polong long startT, currT;
constexpr double TIME_MULT = 1;

double timePassed()
{
    using namespace std::chrono;
    currT = high_resolution_clock::now();
    double time = duration_cast<duration<double>>(currT - startT).count();
    return time * TIME_MULT;
}*/

typedef pair <long long , long long> pii;


vector <pii> v[maxn];
bool used[maxn];


pii dfs(long long node , long long _par , long long depth)
{
    long long current = 0 , cur_ans = depth;
    pii _try;

    for(pii nb : v[node])
    {
        if(nb.X == _par)
            continue;

        _try = dfs(nb.X , node , depth + nb.Y);
        if(_try.X + nb.Y > current)
        {
            current = _try.X + nb.Y;
            cur_ans = min(_try.Y , max(depth , current));
        }
    }
    return make_pair(current , cur_ans);
}



pii f(long long node , long long _par)
{
    used[node] = true;
    pii current;
    current.X = 0;
    current.Y = node;
    pii current2;

    for(pii nb : v[node])
    {
        if(nb.X == _par)
            continue;

        current2 = f(nb.X , node);
        current2.X += nb.Y;
        current = max(current , current2);
    }

    return current;
}




long long travelTime(long long N , long long M , long long L , long long A[] , long long B[] , long long T[])
{
    long long ans = 0;

    for(long long i = 0; i < M; i++)
    {
        v[A[i]].push_back({B[i] , T[i]});
        v[B[i]].push_back({A[i] , T[i]});
    }

    vector <long long> distances;

    for(long long i = 0; i < N; i++)
    {
        if(used[i] == true)
            continue;

        long long dist = f(i , -1).Y;
        pii cur_ans = dfs(dist , 0 , -1);
        ans = max(ans , cur_ans.X);
        distances.pb(cur_ans.Y);
    }


    sort(distances.begin() , distances.end());
    reverse(distances.begin() , distances.end());

    if(distances.size() > 1)
        ans = max(ans , distances[0] + distances[1] + L);
    if(distances.size() > 2)
        ans = max(ans , distances[1] + distances[2] + (2 * L));
    return ans;
}






/**long long main()
{

    #ifdef ONLINE_JUDGE /// promeni
        freopen("taxi.in", "r", stdin);
        freopen("taxi.out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    //startT = std::chrono::high_resolution_clock::now();


    read();
    solve();

    return 0;
}*/

Compilation message

/usr/bin/ld: /tmp/cc3R02RP.o: in function `main':
grader.c:(.text.startup+0xd1): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status