3401 | 2023-02-27 12:53:29 | kdb | Hálózati átvitel | cpp11 | Forditási hiba |
#include <iostream>
#include <vector>
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
*/
exit status 1
main.cpp: In function 'int main()':
main.cpp:33:13: error: 'INT_MAX' was not declared in this scope
33 | ki[k] = INT_MAX;
| ^~~~~~~
main.cpp:3:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
2 | #include <vector>
+++ |+#include <climits>
3 | using namespace std;
Exited with error status 1