195402025-12-14 12:03:35GergoszaboLegtöbb unoka (80 pont)cpp17Forditási hiba
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long n, m; cin >> n >> m;
    vector<int> apa(n+1);
    for (int i = 1; i <= m; i++){
        int a, b; cin >> a >> b;
        apa[b] = a;
    }
    vector<int> gy(n+1);
    int maxu = 0, ind = 0;
    for (int i = 1; i <= n; i++){
        gy[apa[apa[i]]]++;
    }
    for (int i = 1; i <= n; i++){
        if (gy[i] > maxu){
            maxu = gy[i]; ind = i;
        }
    }
    if (maxu == 0} cout << -1;
    else cout << ind << " " << maxu;
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/431/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:23:18: error: expected ')' before '}' token
   23 |     if (maxu == 0} cout << -1;
      |        ~         ^
      |                  )
main.cpp:23:18: error: expected primary-expression before '}' token
main.cpp: At global scope:
main.cpp:23:20: error: 'cout' does not name a type
   23 |     if (maxu == 0} cout << -1;
      |                    ^~~~
main.cpp:24:5: error: expected unqualified-id before 'else'
   24 |     else cout << ind << " " << maxu;
      |     ^~~~
main.cpp:25:5: error: expected unqualified-id before 'return'
   25 |     return 0;
      |     ^~~~~~
main.cpp:26:1: error: expected declaration before '}' token
   26 | }
      | ^