제출 #96631

#제출 시각아이디문제언어결과실행 시간메모리
96631fadi57Deblo (COCI18_deblo)C++14
0 / 90
156 ms20728 KiB
#include <bits/stdc++.h> using namespace std; #define clr(i, j) memset(i, j, sizeof(i)) #define pb push_back typedef long long ll; //-*-*-*-*-*-*-*-*- vector<ll>c[99999];ll sum=0; vector<ll>v[99999];ll w[999999]; void dfs(ll i,ll par){ v[i].push_back(w[i]); for(auto &o:c[i]){ if(o==par){continue;} dfs(o,i); } if(par==0){sum+=w[i]; return;} for(auto &o:v[i]){ v[par].push_back(o^w[par]);sum+=(o^w[par]); } } map<ll,ll>l;ll ans=-999; int main() { ll n;cin>>n; for(int i=1;i<=n;i++){ cin>>w[i]; } for(int i=0;i<n-1;i++){ ll x,y; cin>>x>>y; c[x].push_back(y); c[y].push_back(x); } dfs(1,0); for(auto &o:v[1]){ //cout<<o; }cout<<sum; }

컴파일 시 표준 에러 (stderr) 메시지

deblo.cpp: In function 'int main()':
deblo.cpp:42:12: warning: unused variable 'o' [-Wunused-variable]
  for(auto &o:v[1]){
            ^
#Verdict Execution timeMemoryGrader output
Fetching results...