Submission #748246

#TimeUsernameProblemLanguageResultExecution timeMemory
748246kkkkkkkkFriend (IOI14_friend)C++14
19 / 100
1 ms468 KiB
#include <bits/stdc++.h> using namespace std; int *C; vector<int> nivo_teminja[1005]; int dlabocina_na_teme[1005],najg_dlab; int dp[1005][2]; vector<int> G[1005]; void f(int teme) { if (dlabocina_na_teme[teme]==najg_dlab) { 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; nivo_teminja[0].push_back(0); dlabocina_na_teme[0]=0; for (int i=1;i<n;i++) { G[host[i]].push_back(i); int nivo_parent=dlabocina_na_teme[host[i]]; dlabocina_na_teme[i]=nivo_parent+1; nivo_teminja[dlabocina_na_teme[i]].push_back(i); najg_dlab=max(najg_dlab,dlabocina_na_teme[i]); } f(0); return max(dp[0][0],dp[0][1]); }

Compilation message (stderr)

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