#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (ll)a.size()
#define all(a) a.begin(),a.end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define crep(i,x,n) for(ll i=x;i<n;i++)
#define drep(i,n) for(ll i=n-1;i>=0;i--)
#define vec(...) vector<__VA_ARGS__>
#define _34raRxL ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
void prll(){
cout<<"\n";
}
template<class te,class ...ti>
void prll(const te&v, const ti&...nv) {
cout<<v;
if(sizeof...(nv)){
cout<<" ";
prll(nv...);
}
}
using tpii=pair<ll,pair<ll,ll>>;
using pii=pair<ll,ll>;
using vi=vector<ll>;
using vll=vector<long long>;
void slv(){
ll n;
cin>>n;
vi a(n);
rep(i,n){
cin>>a[i];
}
vec(vi) adj(n);
rep(i,n-1){
ll u,v;
cin>>u>>v;
u--,v--;
adj[u].pb(v);
adj[v].pb(u);
}
vi pxor(n,-1);
ll ans=0;
auto dfs=[&](auto self,ll v,ll par)->void{
for(auto u : adj[v]){
if(u!=par){
self(self,u,v);
}
}
};
dfs(dfs,0,-1);
prll(ans,"\n");
}
int main(){
_34raRxL;
ll t=1;
// cin>>t;
slv();
//
return 0;
}
Compilation message
deblo.cpp: In function 'int main()':
deblo.cpp:63:5: warning: unused variable 't' [-Wunused-variable]
63 | ll t=1;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
6 |
Incorrect |
34 ms |
10452 KB |
Output isn't correct |
7 |
Incorrect |
33 ms |
10464 KB |
Output isn't correct |
8 |
Incorrect |
34 ms |
8592 KB |
Output isn't correct |
9 |
Incorrect |
38 ms |
8408 KB |
Output isn't correct |
10 |
Incorrect |
57 ms |
8308 KB |
Output isn't correct |