34032023-02-27 12:54:59kdbHálózati átvitelcpp11Compilation error
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

std::ostream& operator<<(std::ostream& os, const std::vector<int>& input)
{
    for (auto const& i : input) {
        os << i << "\n";
    }
    return os;
}

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

    int n, m, k, h;
    cin >> n >> m >> k >> h;
    vector<int>ki(n + 1);
    vector<int>ki2(n + 1);
    vector<vector<pair<int, int>>>vec(n + 1);

    for (size_t i = 0; i < m; i++)
    {
        int u, v, w;
        cin >> u >> v >> w;
        vec[u].push_back({ v,w });
        vec[v].push_back({ u,w });
    }

    ki[k] = INT_MAX;
    ki2[k] = INT_MAX;

    for (size_t i = 0; i < h; i++)
    {
        for (size_t j = 1; j < n + 1; j++)
        {
            for (auto q : vec[j])
            {
                if (ki[q.first] < min(q.second, ki2[j]))
                {
                    ki[q.first] = min(q.second, ki2[j]);
                }
            }
        }
        ki2 = ki;
    }
    ki[k] = 0;
    ki.erase(ki.begin());
    cout << ki;
    return 0;
}
/*
5 6 1 2
1 2 2
1 5 4
1 3 2
1 4 3
5 4 1
5 3 4
*/
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:34:13: error: 'INT_MAX' was not declared in this scope
   34 |     ki[k] = INT_MAX;
      |             ^~~~~~~
main.cpp:4:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    3 | #include <cmath>
  +++ |+#include <climits>
    4 | using namespace std;
Exited with error status 1