230212026-01-16 10:48:20RRoliLogisztikai központcpp17Forditási hiba
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    auto sr = [](int a, int b) {return make_pair(min(a,b), max(a,b));};

    int n;
    cin >> n;
    vector<unordered_set<int>> szom(n+1);
    map<pair<int,int>,int> edge;
    for(int i = 0; i < n-1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        szom[a].insert(b);
        szom[b].insert(a);
        edge[sr(a,b)] = c;
    }

    unordered_set<int> level, volt;
    int gyok = -1;
    for(int i = 1; i <= n; i++) {
        if(szom[i].size() == 1) level.insert(i);
        else if(gyok == -1) gyok = i;
    }

    vector<int> apa(n+1, 0);
    vector<unordered_set<int>> fia(n+1);
    queue<int> sor;

    sor.push(gyok);
    volt.insert(gyok);
    while(sor.size() > 0) {
        for(auto i : szom[sor.front()]) {
            if(!volt.count(i)) {
                apa[i] = sor.front();
                fia[sor.front()].insert(i);
                volt.insert(i);
                sor.push(i);
            }
        }
        sor.pop();
    }

    vector<set<int>> alatt(n+1);
    for(auto i : level) {
        alatt[i].push_back(0);
        sor.push(i);
    }

    while(sor.size() > 0) {
        apa[sor.front].
    }

    /*for(int i = 1; i <= n; i++) {
        cout << "\n\n" << i;
        cout << "\napa: " << apa[i];
        cout << "\nfia: ";
        for(auto j : fia[i]) cout << j << ' ';
    }*/

    //for(auto i : level) cout << i << ' ';
    //cout << '\n' << gyok;

	return 0;
}
Forditási hiba
open /var/local/lib/isolate/426/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:48:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::set<int> >, std::set<int> >::value_type' {aka 'class std::set<int>'} has no member named 'push_back'
   48 |         alatt[i].push_back(0);
      |                  ^~~~~~~~~
main.cpp:53:12: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '<unresolved overloaded function type>')
   53 |         apa[sor.front].
      |            ^
In file included from /usr/include/c++/12/vector:64,
                 from /usr/include/c++/12/functional:62,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:71,
                 from main.cpp:1:
/usr/include/c++/12/bits/stl_vector.h:1121:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1121 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/12/bits/stl_vector.h:1121:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1121 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/12/bits/stl_vector.h:1140:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1140 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/12/bits/stl_vector.h:1140:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1140 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
main.cpp:54:5: error:...