Submission #748247

#TimeUsernameProblemLanguageResultExecution timeMemory
748247kkkkkkkkFriend (IOI14_friend)C++14
19 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; int *C; int dp[1005][2]; vector<int> G[1005]; void f(int teme) { if (G[teme].size()==0) { dp[teme][0]=C[teme]; dp[teme][1]=0; } dp[teme][0]=C[teme]; for (int i=0;i<G[teme].size();i++){ int child=G[teme][i]; f(child); dp[teme][0]+=dp[child][1]; dp[teme][1]+=max(dp[child][0],dp[child][1]); } } int findSample(int n,int confidence[],int host[],int protocol[]) { C=confidence; for (int i=1;i<n;i++) G[host[i]].push_back(i); f(0); return max(dp[0][0],dp[0][1]); }

Compilation message (stderr)

friend.cpp: In function 'void f(int)':
friend.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i=0;i<G[teme].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...