Submission #586190

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5861902022-06-30 04:03:53krit3379Friend (IOI14_friend)C++17
46 / 100
24 ms4524 KiB
#include<bits/stdc++.h>
#include"friend.h"
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 100005
int dp[N][2],sum,ans;
bool f[3];
vector<int> g[N];
void dfs(int s,int f,int confidence[]){
for(auto x:g[s]){
if(x==f)continue;
dfs(x,s,confidence);
dp[s][1]+=dp[x][0];
dp[s][0]+=max(dp[x][0],dp[x][1]);
}
dp[s][1]+=confidence[s];
ans=max({ans,dp[s][0],dp[s][1]});
}
int findSample(int n,int confidence[],int host[],int protocol[]){
int i,j,k;
if(n<=10){
bitset<15> vis[N];
for(i=0;i<=n;i++)vis[i]=0;
for(i=1;i<n;i++){
if(protocol[i])for(j=0;j<n;j++)if(vis[host[i]][j])vis[i][j]=vis[j][i]=true;
if(protocol[i]!=1)vis[i][host[i]]=vis[host[i]][i]=true;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...