Submission #1041516

#TimeUsernameProblemLanguageResultExecution timeMemory
1041516owoovoJobs (BOI24_jobs)C++17
11 / 100
37 ms14536 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; ll dp[300010]; vector<pair<ll,ll>> vc; int main(){ ios::sync_with_stdio(0); cin.tie(0); ll n,s; cin>>n>>s; for(int i=0;i<n;i++){ ll a,b; cin>>a>>b; vc.push_back({a,b}); } for(int i=n-1;i>=0;i--){ dp[i+1]+=vc[i].F; dp[vc[i].S]+=max(0LL,dp[i+1]); } cout<<dp[0]<<"\n"; return 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...