Submission #404493

#TimeUsernameProblemLanguageResultExecution timeMemory
404493wmrmrFriend (IOI14_friend)C++17
100 / 100
31 ms3420 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int MAX = 1e5; int p[MAX], q[MAX]; // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=0;i<n;i++) p[i] = confidence[i]; int h; for(int i=n-1;i>0;i--) { int h = host[i], c = protocol[i]; int a0 = p[h], a1 = p[i] , b0 = q[h] , b1 = q[i]; if(c == 0) { p[h] += b1; q[h] += max(a1,b1); } if(c == 1) { p[h] = max( a0 + max( a1 , b1 ) , a1 + b0 ); q[h] += b1; } if(c == 2) { p[h] = max ( a0 + b1 , a1 + b0 ); q[h] += b1; } } return max( p[0] , q[0] ); }

Compilation message (stderr)

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