Submission #633973

#TimeUsernameProblemLanguageResultExecution timeMemory
633973radalNetwork (BOI15_net)C++17
0 / 100
2 ms2644 KiB
#include <bits/stdc++.h> #pragma GCC target("sse,sse2") #pragma GCC optimize("unroll-loops,O3") #define rep(i,l,r) for (int i = l; i < r; i++) #define repr(i,r,l) for (int i = r; i >= l; i--) #define X first #define Y second #define all(x) (x).begin() , (x).end() #define pb push_back #define endl '\n' #define debug(x) cerr << #x << " : " << x << endl; using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pll; constexpr int N = 1e5+20,mod = 1e9+7,inf = 1e9+10; inline int mkay(int a,int b){ if (a+b >= mod) return a+b-mod; if (a+b < 0) return a+b+mod; return a+b; } inline int poww(int a,int k){ if (k < 0) return 0; int z = 1; while (k){ if (k&1) z = 1ll*z*a%mod; a = 1ll*a*a%mod; k /= 2; } return z; } vector<int> adj[N]; int main(){ ios_base :: sync_with_stdio(0); cin.tie(0); int n,ans = 0; cin >> n; rep(i,1,n){ int u,v; cin >> u >> v; adj[u].pb(v); adj[v].pb(u); } rep(i,1,n+1) ans += (adj[i].size() == 1); cout << (ans+1)/2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...