2232021-03-05 08:56:54Valaki2Átvágás (75 pont)cpp14Wrong answer 2/75158ms29916 KiB
#include<iostream>
#include<vector>
using namespace std;

int n, a, b, ans1, ans2;
int fokszam[200001];

int main() {
  cin >> n;
  for(int i = 0; i < n-1; ++i) {
    cin >> a >> b;
    ++fokszam[a];
    ++fokszam[b];
  }
  int maxfokszam = 0;
  for(int i = 1; i <= n; ++i) {
    // csillag
    maxfokszam = max(maxfokszam, fokszam[i]);
    // bambusz
    // egyik valasz verzio
    if(fokszam[i] > 2) {
      ans1 += fokszam[i] - 2;
    }
    //masik valasz verzio
    if(fokszam[i] == 1) {
      ++ans2;
    }
  }
  ans2 -= 2;
  cout << n-1-maxfokszam << " " << ans1 << "\n";
  return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/75
1Accepted0/02ms1932 KiB
2Accepted0/01ms1924 KiB
3Accepted0/07ms2136 KiB
4Wrong answer0/42ms2068 KiB
5Wrong answer0/41ms2064 KiB
6Wrong answer0/41ms2068 KiB
7Wrong answer0/42ms2076 KiB
8Wrong answer0/42ms2076 KiB
9Wrong answer0/42ms2084 KiB
10Wrong answer0/4135ms5304 KiB
11Wrong answer0/4127ms7220 KiB
12Wrong answer0/4125ms9604 KiB
13Wrong answer0/4127ms12148 KiB
14Wrong answer0/4128ms14660 KiB
15Wrong answer0/4158ms17180 KiB
16Wrong answer0/4135ms19700 KiB
17Wrong answer0/4126ms22228 KiB
18Wrong answer0/5128ms24752 KiB
19Wrong answer0/6137ms27276 KiB
20Wrong answer0/6137ms29916 KiB
21Accepted2/21ms28356 KiB