37732023-03-02 21:46:45BttrngLegtöbb unoka (80 pont)cpp17Wrong answer 60/808ms5372 KiB
#include<bits/stdc++.h>
using namespace std;
vector<int>gy;
vector<int>u;


int main(){
  int n, m;
  cin>>n>>m;
  vector<vector<int> >s(n+1);
  gy.resize(n+1);
  u.resize(n+1);
  for(int i=1; i<=m; i++){
    int x, y;
    cin>>x>>y;
    s[x].push_back(y);
    gy[x]++;
  }
  int ln=0, sor;
  for(int i=1; i<=n; i++){
    for(int x : s[i]){
        u[i]+=gy[x];
    }
    if(ln<u[i]){
        ln=u[i];
        sor=i;
    }
  }
  cout<<sor<<" "<<ln<<endl;

}
SubtaskSumTestVerdictTimeMemory
base60/80
1Accepted0/03ms1808 KiB
2Accepted0/06ms2832 KiB
3Wrong answer0/42ms2084 KiB
4Wrong answer0/43ms2216 KiB
5Accepted4/48ms3292 KiB
6Accepted4/48ms3648 KiB
7Wrong answer0/43ms2884 KiB
8Wrong answer0/43ms2852 KiB
9Accepted4/46ms3516 KiB
10Accepted4/48ms3864 KiB
11Accepted4/48ms3740 KiB
12Accepted4/46ms3828 KiB
13Accepted4/48ms4136 KiB
14Accepted4/48ms4200 KiB
15Accepted4/48ms4332 KiB
16Accepted4/48ms4092 KiB
17Accepted4/48ms4620 KiB
18Accepted4/48ms4480 KiB
19Wrong answer0/23ms3936 KiB
20Wrong answer0/23ms3940 KiB
21Accepted3/33ms4200 KiB
22Accepted3/33ms4172 KiB
23Accepted3/38ms5164 KiB
24Accepted3/38ms5372 KiB