36942023-03-02 11:08:33DalmaLegtöbb unoka (80 pont)cpp17Wrong answer 60/809ms5484 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/03ms1808 KiB
2Accepted0/06ms3036 KiB
3Wrong answer0/43ms2404 KiB
4Wrong answer0/42ms2468 KiB
5Accepted4/48ms3408 KiB
6Accepted4/48ms3608 KiB
7Wrong answer0/42ms2792 KiB
8Wrong answer0/43ms2812 KiB
9Accepted4/46ms3428 KiB
10Accepted4/48ms3960 KiB
11Accepted4/49ms4328 KiB
12Accepted4/46ms4180 KiB
13Accepted4/48ms4496 KiB
14Accepted4/48ms4608 KiB
15Accepted4/48ms4652 KiB
16Accepted4/48ms4884 KiB
17Accepted4/48ms5272 KiB
18Accepted4/48ms5056 KiB
19Wrong answer0/23ms4360 KiB
20Wrong answer0/23ms4440 KiB
21Accepted3/33ms4660 KiB
22Accepted3/33ms4588 KiB
23Accepted3/38ms5484 KiB
24Accepted3/38ms5484 KiB