31172023-02-16 14:53:29PallanekPéterLegtöbb unoka (80 pont)python3Accepted 80/8050ms16708 KiB
n,m=[int(i) for i in input().split()]
csalad=[[] for i in range(n)]
for i in range(m):
    u,v=[int(i) for i in input().split()]
    csalad[u-1].append(v-1)
Ldb=0
for i in range(n):
    ossz=0
    for j in range(len(csalad[i])):
        ossz+=len(csalad[csalad[i][j]])
    if ossz>Ldb:
        Ldb=ossz; Lh=i+1
if Ldb==0:
    print(-1)
else:
    print(Lh,Ldb)
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/018ms11156 KiB
2Accepted0/037ms13632 KiB
3Accepted4/417ms11760 KiB
4Accepted4/417ms11800 KiB
5Accepted4/448ms14436 KiB
6Accepted4/448ms14528 KiB
7Accepted4/417ms12060 KiB
8Accepted4/417ms12272 KiB
9Accepted4/434ms13748 KiB
10Accepted4/450ms15104 KiB
11Accepted4/448ms15332 KiB
12Accepted4/434ms13976 KiB
13Accepted4/448ms15372 KiB
14Accepted4/450ms15280 KiB
15Accepted4/450ms15472 KiB
16Accepted4/450ms15652 KiB
17Accepted4/448ms15888 KiB
18Accepted4/448ms15888 KiB
19Accepted2/225ms14764 KiB
20Accepted2/225ms15032 KiB
21Accepted3/325ms15148 KiB
22Accepted3/328ms15384 KiB
23Accepted3/350ms16660 KiB
24Accepted3/348ms16708 KiB