이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#include "friend.h"
// Find out best sample
//0 - i am you friend
//1 - my friends are your friends
//2 - we are your friends
int findSample(int n,int cost[],int par[],int t[]){
int ans = 0;
for (int u = n - 1; u; --u) {
if (cost[u] <= 0)
continue;
if (t[u] == 0) {
cost[par[u]] -= cost[u];
//???
cost[par[u]] = max(cost[par[u]], 0);
ans += cost[u];
}
else if (t[u] == 1) {
cost[par[u]] += cost[u];
}
else if (t[u] == 2) {
cost[par[u]] = max(cost[par[u]], cost[u]);
}
}
ans += max(0, cost[0]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |