21102022-12-20 09:25:03zsebiLogisztikai központcpp11Compilation error
// logisztikai kozpont.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <queue>
#include <algorithm>

#define ll long long
using namespace std;

ll n, a, b, c;
struct adat
{
    vector<pair<ll, ll>>sz;
    
};
vector<adat>x;
int main()
{
    cin >> n;
    x.resize(n + 1);
    vector<ll>lat(n + 1), lep(n + 1),most(n+1);
    for (int i = 1; i < n; ++i)
    {
        cin >> a >> b >> c;
        x[a].sz.push_back({ b,c });
        x[b].sz.push_back({ a,c });
    }
    deque<ll>v;
    for (int i = 1; i <= n; ++i)
    {
        ll maxi = 0;
        v.push_back(i);
        while (!v.empty())
        {
            ll akt = v.front();
            v.pop_front();
            lat[akt] = 1;
            for (auto& e : x[akt].sz)
            {
                if (!lat[e.first])
                {
                    lep[e.first] = lep[akt] + e.second;
                    maxi = max(maxi, lep[e.first]);
                    v.push_back(e.first);
                }
            }


        }
        most[i] = maxi;
        fill( lep.begin(),lep.end(), 0);
        fill(lat.begin(),lat.end(),0);

    }
    ll mini = LLONG_MAX;
    vector<ll>ans;
    for (int i = 1; i <= n; ++i)
        mini = min(mini, most[i]);
    for (int i = 1; i <= n; ++i)
        if (most[i] == mini)
            ans.push_back(i);
    cout << mini << "\n" << ans.size()<<"\n";
    for (auto& e : ans)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
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:56:15: error: 'LLONG_MAX' was not declared in this scope
   56 |     ll mini = LLONG_MAX;
      |               ^~~~~~~~~
main.cpp:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    6 | #include <algorithm>
  +++ |+#include <climits>
    7 | 
Exited with error status 1