# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404493 | wmrmr | Friend (IOI14_friend) | C++17 | 31 ms | 3420 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |