Submission #1051316

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10513162024-08-10 04:25:30nisanduuJobs (BOI24_jobs)C++14
0 / 100
221 ms40528 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dfs(ll node,vector<vector<ll>>&adj,ll money,ll p,map<ll,ll> &cost){
ll cr = money;
cr += cost[node];
for(auto el:adj[node]){
if(el!=p){
cr = max(cr,dfs(el,adj,cr,node,cost));
}
}
return cr;
}
void solve(){
ll n,s;
cin>>n>>s;
vector<vector<ll>> adj(n+10);
map<ll,ll> cost;
vector<ll> edges(n+10);
queue<ll> q;
for(ll i=0;i<n;i++){
ll x,p;
cin>>x>>p;
cost[i] = x;
if(p==0){
q.push(p);
}else{
edges[i]++;
adj[p-1].push_back(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...