36972023-03-02 11:15:37MatematikaLegtöbb unoka (80 pont)cpp17Wrong answer 60/808ms5580 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    int legnagyobb=-1;
    int legsorszam=-1;
    cin >> n >> m;
    vector<int> megoldas(n);
    vector<vector<int>> vec(n);
    vector<int> apa(m);
    vector<int> gyerek(m);
    for(int i=0; i<m; i++)
    {
        cin >> apa[i];
        apa[i]--;
        cin >> gyerek[i];
        gyerek[i]--;
    }
    for(int i=0; i<m; i++)
    {
        vec[apa[i]].push_back(gyerek[i]);
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<vec[i].size(); j++)
        {
            megoldas[i]=megoldas[i]+vec[vec[i][j]].size();
        }
    }
    for(int i=0; i<n; i++)
    {
        if(legnagyobb<megoldas[i])
        {
            legnagyobb=megoldas[i];
            legsorszam=i+1;
        }
    }
    cout << legsorszam << " " << legnagyobb;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base60/80
1Accepted0/03ms1816 KiB
2Accepted0/06ms2884 KiB
3Wrong answer0/43ms2260 KiB
4Wrong answer0/43ms2476 KiB
5Accepted4/48ms3392 KiB
6Accepted4/48ms3624 KiB
7Wrong answer0/42ms2732 KiB
8Wrong answer0/42ms2956 KiB
9Accepted4/46ms3460 KiB
10Accepted4/48ms4012 KiB
11Accepted4/48ms3980 KiB
12Accepted4/46ms3792 KiB
13Accepted4/48ms4364 KiB
14Accepted4/48ms4556 KiB
15Accepted4/48ms4476 KiB
16Accepted4/48ms4688 KiB
17Accepted4/48ms5188 KiB
18Accepted4/48ms5152 KiB
19Wrong answer0/23ms4612 KiB
20Wrong answer0/23ms4696 KiB
21Accepted3/33ms4624 KiB
22Accepted3/33ms4536 KiB
23Accepted3/38ms5580 KiB
24Accepted3/38ms5504 KiB