36892023-03-02 10:51:06JMMirkoLegtöbb unoka (80 pont)cpp17Accepted 80/808ms4968 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n,m;
	cin >> n >> m;
	vector<vector<int> > v(n);
	for(int i=0;i<m;i++){
		int a,b;
		cin >> a >> b;
		v[a-1].push_back(b-1);
	}

	vector<int> ve(n);
	for(int i=0;i<n;i++){
		
		for(int j=0; j < v[i].size();j++){
			ve[i]+=v[v[i][j]].size();
		}
	}
	int ma=0;
	int ind;
	for(int i=0;i<n;i++){
		if(ve[i]>ma){
			ma=ve[i];
			ind=i;
		}
	}
	if(ma==0)cout << -1;
	else cout << ind+1 << ' ' << ve[ind]; 
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1808 KiB
2Accepted0/06ms2768 KiB
3Accepted4/43ms2212 KiB
4Accepted4/42ms2428 KiB
5Accepted4/48ms3220 KiB
6Accepted4/48ms3476 KiB
7Accepted4/42ms2844 KiB
8Accepted4/43ms3040 KiB
9Accepted4/46ms4040 KiB
10Accepted4/48ms4196 KiB
11Accepted4/48ms4448 KiB
12Accepted4/46ms4304 KiB
13Accepted4/48ms4648 KiB
14Accepted4/48ms4660 KiB
15Accepted4/48ms4540 KiB
16Accepted4/48ms4560 KiB
17Accepted4/48ms4712 KiB
18Accepted4/48ms4756 KiB
19Accepted2/23ms4320 KiB
20Accepted2/23ms4324 KiB
21Accepted3/33ms4216 KiB
22Accepted3/33ms4480 KiB
23Accepted3/38ms4968 KiB
24Accepted3/38ms4964 KiB