18672022-12-06 11:04:29kdbLegtöbb unoka (80 pont)cpp11Wrong answer 60/804ms4376 KiB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<vector<int>>vec(n + 1);
    vector<int>vec2(n + 1);
    for (size_t i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        vec[a].push_back(b);
        vec2[a]++;
    }
    int mk = 0, mh = 0, lh = 0;
    for (size_t i = 1; i < n; i++)
    {
        for (int j : vec[i])
        {
            lh += vec2[j];
        }
        if (lh > mh)
        {
            mk = i;
            mh = lh;
        }
        lh = 0;
    }
    cout << mk << " " << mh << endl;
}
/*
10 9
1 2
2 4
1 3
3 5
5 7
5 8
5 9
3 6
6 10
-3 4
*/
SubtaskSumTestVerdictTimeMemory
base60/80
1Accepted0/03ms1828 KiB
2Accepted0/04ms2708 KiB
3Wrong answer0/42ms2224 KiB
4Wrong answer0/42ms2428 KiB
5Accepted4/44ms3196 KiB
6Accepted4/44ms3452 KiB
7Wrong answer0/42ms2712 KiB
8Wrong answer0/42ms2736 KiB
9Accepted4/44ms3156 KiB
10Accepted4/44ms3508 KiB
11Accepted4/44ms3504 KiB
12Accepted4/43ms3316 KiB
13Accepted4/44ms3752 KiB
14Accepted4/44ms3828 KiB
15Accepted4/44ms3700 KiB
16Accepted4/44ms3704 KiB
17Accepted4/44ms3912 KiB
18Accepted4/44ms3828 KiB
19Wrong answer0/22ms3656 KiB
20Wrong answer0/22ms3660 KiB
21Accepted3/32ms3516 KiB
22Accepted3/32ms3540 KiB
23Accepted3/34ms4376 KiB
24Accepted3/34ms4348 KiB