2242021-03-05 09:07:38Valaki2Átvágás (75 pont)cpp14Wrong answer 2/75150ms29824 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/02ms1880 KiB
2Accepted0/01ms2052 KiB
3Wrong answer0/06ms2228 KiB
4Wrong answer0/41ms2152 KiB
5Wrong answer0/41ms2164 KiB
6Wrong answer0/41ms2172 KiB
7Wrong answer0/41ms2164 KiB
8Wrong answer0/41ms2172 KiB
9Wrong answer0/41ms2176 KiB
10Wrong answer0/4105ms5388 KiB
11Wrong answer0/4119ms7392 KiB
12Wrong answer0/4134ms9792 KiB
13Wrong answer0/4129ms12216 KiB
14Wrong answer0/4143ms14712 KiB
15Wrong answer0/4143ms17224 KiB
16Wrong answer0/4150ms19760 KiB
17Wrong answer0/4137ms22264 KiB
18Wrong answer0/5142ms24784 KiB
19Wrong answer0/6149ms27312 KiB
20Wrong answer0/6130ms29824 KiB
21Accepted2/21ms28376 KiB