Submission #16524

# Submission time Handle Problem Language Result Execution time Memory
16524 2015-08-27T03:23:19 Z eaststar Friend (IOI14_friend) C++14
100 / 100
26 ms 3036 KB
#include "friend.h"
#include <algorithm>
using namespace std;
int a[100010],b[100010];
int findSample(int n,int *c,int *h,int *p){
    int i;
    for(i=0;i<n;++i)a[i]=c[i];
    for(;--i;){
        if(!p[i]){
            a[h[i]]+=b[i];
            b[h[i]]+=max(a[i],b[i]);
        }
        else if(p[i]==1){
            a[h[i]]=max(a[h[i]]+max(a[i],b[i]),b[h[i]]+a[i]);
            b[h[i]]+=b[i];
        }
        else{
            a[h[i]]=max(a[h[i]]+b[i],b[h[i]]+a[i]);
            b[h[i]]+=b[i];
        }
    }
    return max(a[0],b[0]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
11 Correct 0 ms 3036 KB Output is correct
12 Correct 0 ms 3036 KB Output is correct
13 Correct 0 ms 3036 KB Output is correct
14 Correct 0 ms 3036 KB Output is correct
15 Correct 0 ms 3036 KB Output is correct
16 Correct 0 ms 3036 KB Output is correct
17 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
11 Correct 0 ms 3036 KB Output is correct
12 Correct 0 ms 3036 KB Output is correct
13 Correct 0 ms 3036 KB Output is correct
14 Correct 0 ms 3036 KB Output is correct
15 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
11 Correct 0 ms 3036 KB Output is correct
12 Correct 0 ms 3036 KB Output is correct
13 Correct 0 ms 3036 KB Output is correct
14 Correct 0 ms 3036 KB Output is correct
15 Correct 0 ms 3036 KB Output is correct
16 Correct 0 ms 3036 KB Output is correct
17 Correct 0 ms 3036 KB Output is correct
18 Correct 0 ms 3036 KB Output is correct
19 Correct 0 ms 3036 KB Output is correct
20 Correct 0 ms 3036 KB Output is correct
21 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
11 Correct 0 ms 3036 KB Output is correct
12 Correct 0 ms 3036 KB Output is correct
13 Correct 0 ms 3036 KB Output is correct
14 Correct 0 ms 3036 KB Output is correct
15 Correct 26 ms 3036 KB Output is correct