| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1288809 | Faisal_Saqib | 친구 (IOI14_friend) | C++17 | 2 ms | 2884 KiB |
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+100;
int dp[N][2],a[N];
vector<int> ma[N];
void dfs(int x) // dp[x][0] = not taking, dp[x][1] = taking
{
dp[x][0]=0;
dp[x][1]=a[x];
for(auto y:ma[x])
{
dfs(y);
dp[x][0]+=max(dp[y][0],dp[y][1]);
dp[x][1]+=dp[y][0];
}
}
int findSample(int n,int confidence[],int host[],int protocol[]){
for(int i=0;i<n;i++)a[i]=confidence[i];
for(int i=1;i<n;i++)
{
ma[host[i]].push_back(i);
}
dfs(0);
return max(dp[0][0],dp[0][1]);
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
