Submission #404171

#TimeUsernameProblemLanguageResultExecution timeMemory
404171peuchFriend (IOI14_friend)C++17
19 / 100
1 ms332 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 10; int dp[MAXN][2]; int v[MAXN]; vector<int> ar[MAXN]; void dfs(int cur); int findSample(int n,int confidence[],int host[],int protocol[]){ memset(dp, -1, sizeof(dp)); for(int i = 0; i < n; i++) v[i] = confidence[i]; for(int i = 1; i < n; i++) ar[host[i]].push_back(i); dfs(0); return dp[0][1]; } void dfs(int cur){ dp[cur][0] = 0; dp[cur][1] = v[cur]; for(int i = 0; i < ar[cur].size(); i++){ int viz = ar[cur][i]; dfs(viz); dp[cur][0] += dp[viz][1]; dp[cur][1] += dp[viz][0]; } dp[cur][1] = max(dp[cur][1], dp[cur][0]); }

Compilation message (stderr)

friend.cpp: In function 'void dfs(int)':
friend.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 0; i < ar[cur].size(); i++){
      |                 ~~^~~~~~~~~~~~~~~~
#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...