70532023-12-29 07:35:49MagyarKendeSZLGLegtöbb unoka (80 pont)cpp17Wrong answer 60/806ms4796 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)

using namespace std;
using u16 = unsigned short;

int main() {
    speed;

    u16 N, M;
    cin >> N >> M;

    vector<vector<u16>> g(N + 1);
    while (M--) {
        u16 U, V;
        cin >> U >> V;
        g[U].push_back(V);
    }

    int max_n = 0, max_v = 0;

    for (int s = 1; s <= N; s++) {
        int curr = 0;
        for (int child : g[s]) {
            curr += g[child].size();
        }
        if (max_v < curr) {
            max_v = curr;
            max_n = s;
        }
    }

    cout << max_n << ' ' << max_v;
}
SubtaskSumTestVerdictTimeMemory
base60/80
1Accepted0/03ms1828 KiB
2Accepted0/04ms2712 KiB
3Wrong answer0/43ms2100 KiB
4Wrong answer0/42ms2108 KiB
5Accepted4/46ms2924 KiB
6Accepted4/46ms3024 KiB
7Wrong answer0/43ms2544 KiB
8Wrong answer0/43ms2756 KiB
9Accepted4/44ms3448 KiB
10Accepted4/46ms3864 KiB
11Accepted4/46ms4084 KiB
12Accepted4/44ms3968 KiB
13Accepted4/46ms4164 KiB
14Accepted4/46ms4164 KiB
15Accepted4/46ms4168 KiB
16Accepted4/46ms4248 KiB
17Accepted4/46ms4392 KiB
18Accepted4/46ms4400 KiB
19Wrong answer0/23ms3816 KiB
20Wrong answer0/23ms3780 KiB
21Accepted3/33ms3904 KiB
22Accepted3/33ms4012 KiB
23Accepted3/36ms4544 KiB
24Accepted3/36ms4796 KiB