Submission #424377

#TimeUsernameProblemLanguageResultExecution timeMemory
424377APROHACKFriend (IOI14_friend)C++14
100 / 100
36 ms3148 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; #define PB push_back #define F first #define S second #define yo 0 #define ellos 1 #define nosotros 2 //vector<int>ady[100001]; //bool recorrido[100001]; //bool prendido[100001]; //int mem[1001][2]; //vector<int>conf; // Find out best sample int si[100002], no[100002]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 0 ; i < n ; i++){ si[i]=confidence[i]; no[i]=0; } int mx=0; for(int i = n-1 ; i >= 1 ; i--){ if(protocol[i]==yo){ si[host[i]]+=no[i]; no[host[i]]+=max(si[i], no[i]); //mx=max(mx, max(si[host[i]], no[host[i]])); }else if(protocol[i]==ellos){ si[host[i]] = max(max(si[host[i]]+no[i], no[host[i]]+si[i]), si[host[i]]+si[i]); no[host[i]]+=no[i]; //mx=max(mx, max(si[host[i]], no[host[i]])); }else{ si[host[i]] = max(si[host[i]] + no[i], no[host[i]]+si[i]); no[host[i]] += no[i]; //mx=max(mx, max(si[host[i]], no[host[i]])); } } return max(si[0], no[0]); }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:22:6: warning: unused variable 'mx' [-Wunused-variable]
   22 |  int mx=0;
      |      ^~
#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...