22842023-01-09 12:46:49bzsofiaLogisztikai központcpp11Forditási hiba
// Logisztikai kozpont.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <queue>

using namespace std;

long long a, b, c, i, n, kezd, akt, maxt, mint = 9999999999999999, ido[100001][100001];
queue <long long> s;
vector <long long> mini;

struct adat
{
    long long tav;
    bool lat;
    vector <long long> sz;
};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    vector <adat> x(n + 1);
    //vector <vector<long long>> ido(n + 1, vector <long long>(n + 1));
    for (i = 1; i < n; ++i)
    {
        cin >> a >> b >> c;
        ido[a][b] = ido[b][a] = c;

        x[a].sz.push_back(b);
        x[b].sz.push_back(a);
    }

    for (kezd = 1; kezd <= n; ++kezd)
    {
        for (i = 1; i <= n; ++i)
        {
            x[i].lat = 0;
            x[i].tav = 0;
        }

        x[kezd].lat = 1;
        s.push(kezd);
        while (!s.empty())
        {
            akt = s.front();
            s.pop();
            for (auto& e : x[akt].sz)
            {
                if (!x[e].lat)
                {
                    x[e].lat = 1;
                    x[e].tav = x[akt].tav + ido[akt][e];
                    s.push(e);
                }
            }
        }

        maxt = 0;
        for (i = 1; i <= n; ++i)
        {
            if (x[i].tav > maxt)
            {
                maxt = x[i].tav;
            }
        }

        if (maxt < mint)
        {
            mint = maxt;
            mini.clear();
            mini.push_back(kezd);
        }
        else if (maxt == mint) mini.push_back(kezd);
    }

    cout << mint << "\n" << mini.size() << "\n";
    for (auto& e : mini) cout << e << " ";

    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Forditási hiba
exit status 1
/tmp/cc4cy5YX.o: in function `main':
main.cpp:(.text.startup+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
main.cpp:(.text.startup+0x33): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4cy5YX.o
main.cpp:(.text.startup+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
main.cpp:(.text.startup+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
main.cpp:(.text.startup+0x58): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4cy5YX.o
main.cpp:(.text.startup+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc4...