110292024-06-21 23:07:58CWMKaktuszgráfcpp17Forditási hiba
#include <iostream>
#include <vector>
using namespace std;

int n, m;
vector<vector<int>> graph;
vector<int> LNum;
vector<int> disc;
int lastDisc = 0;
void DFS(int vertexNum, int directParent) {
    disc[lastDisc] = vertexNum;
    LNum[vertexNum] = lastDisc;
    lastDisc++;
    for (auto neigh : graph[vertexNum]) {
        if (LNum[neigh] == INT_MAX) {
            DFS(neigh, vertexNum);
        }
    }
    for (auto neigh : graph[vertexNum]) {
        if (neigh != directParent) {
            LNum[vertexNum] = min(LNum[vertexNum], LNum[neigh]);
        }
    }
    return;
}

int main()
{
    cin >> n >> m;
    graph.resize(n);
    LNum.resize(n, INT_MAX);
    disc.resize(n, -1);
    for (size_t i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    DFS(0, -1);
    vector<int> counts(n);
    for (size_t i = 0; i < LNum.size(); i++)
    {
        counts[LNum[i]]++;
    }
    int maxV = -1;
    for (size_t i = 0; i < counts.size(); i++)
    {
        maxV = max(maxV, counts[i]);
    }
    cout << maxV;
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/400/box/a.out: no such file or directory
main.cpp: In function 'void DFS(int, int)':
main.cpp:15:28: error: 'INT_MAX' was not declared in this scope
   15 |         if (LNum[neigh] == 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;
main.cpp: In function 'int main()':
main.cpp:31:20: error: 'INT_MAX' was not declared in this scope
   31 |     LNum.resize(n, INT_MAX);
      |                    ^~~~~~~
main.cpp:31:20: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?