제출 #994664

#제출 시각아이디문제언어결과실행 시간메모리
994664emptypringlescanJobs (BOI24_jobs)C++17
11 / 100
70 ms20304 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<int,long long> > adj[300005]; long long dp(int x){ long long ret=0; for(auto i:adj[x]){ ret+=max(dp(i.first)+i.second,0ll); } return ret; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); long long n,m; cin >> n >> m; for(int i=1; i<=n; i++){ long long a,b; cin >> a >> b; adj[b].push_back({i,a}); } cout << dp(0); }
#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...