제출 #1063013

#제출 시각아이디문제언어결과실행 시간메모리
1063013antonJobs (BOI24_jobs)C++17
0 / 100
8 ms14684 KiB
#include<bits/stdc++.h> using namespace std; const int MAX_N = 3e5+1; int N, S; vector<int> ch[MAX_N]; int x[MAX_N]; int dfs(int u){ int res= 0; res += x[u]; for(auto e: ch[u]){ res += dfs(e); } return max(0, res); } signed main(){ cin>>N>>S; for(int i = 0; i<N; i++){ int anc; cin>>x[i]>>anc; ch[anc].push_back(i+1); } cout<<dfs(0)<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...