# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7288 |
2014-07-29T10:50:06 Z |
gs13068 |
Friend (IOI14_friend) |
C++ |
|
36 ms |
3040 KB |
#include "friend.h"
#include <algorithm>
int d1[100000];
int d2[100000];
int findSample(int n,int c[],int h[],int p[])
{
int i;
for(i=0;i<n;i++)d1[i]=c[i];
for(i=n-1;i>0;i--)
{
if(p[i]==0)
{
d1[h[i]]+=d2[i];
d2[h[i]]+=std::max(d1[i],d2[i]);
}
if(p[i]==1)
{
d1[h[i]]=std::max(d2[h[i]]+d1[i],d1[h[i]]+std::max(d1[i],d2[i]));
d2[h[i]]+=d2[i];
}
if(p[i]==2)
{
d1[h[i]]=std::max(d2[h[i]]+d1[i],d1[h[i]]+d2[i]);
d2[h[i]]+=d2[i];
}
}
return std::max(d1[0],d2[0]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
11 |
Correct |
0 ms |
3040 KB |
Output is correct |
12 |
Correct |
0 ms |
3040 KB |
Output is correct |
13 |
Correct |
0 ms |
3040 KB |
Output is correct |
14 |
Correct |
0 ms |
3040 KB |
Output is correct |
15 |
Correct |
0 ms |
3040 KB |
Output is correct |
16 |
Correct |
0 ms |
3040 KB |
Output is correct |
17 |
Correct |
0 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
11 |
Correct |
0 ms |
3040 KB |
Output is correct |
12 |
Correct |
0 ms |
3040 KB |
Output is correct |
13 |
Correct |
0 ms |
3040 KB |
Output is correct |
14 |
Correct |
0 ms |
3040 KB |
Output is correct |
15 |
Correct |
0 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
11 |
Correct |
0 ms |
3040 KB |
Output is correct |
12 |
Correct |
0 ms |
3040 KB |
Output is correct |
13 |
Correct |
0 ms |
3040 KB |
Output is correct |
14 |
Correct |
0 ms |
3040 KB |
Output is correct |
15 |
Correct |
0 ms |
3040 KB |
Output is correct |
16 |
Correct |
0 ms |
3040 KB |
Output is correct |
17 |
Correct |
0 ms |
3040 KB |
Output is correct |
18 |
Correct |
0 ms |
3040 KB |
Output is correct |
19 |
Correct |
0 ms |
3040 KB |
Output is correct |
20 |
Correct |
0 ms |
3040 KB |
Output is correct |
21 |
Correct |
0 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3040 KB |
Output is correct |
2 |
Correct |
0 ms |
3040 KB |
Output is correct |
3 |
Correct |
0 ms |
3040 KB |
Output is correct |
4 |
Correct |
0 ms |
3040 KB |
Output is correct |
5 |
Correct |
0 ms |
3040 KB |
Output is correct |
6 |
Correct |
0 ms |
3040 KB |
Output is correct |
7 |
Correct |
0 ms |
3040 KB |
Output is correct |
8 |
Correct |
0 ms |
3040 KB |
Output is correct |
9 |
Correct |
0 ms |
3040 KB |
Output is correct |
10 |
Correct |
0 ms |
3040 KB |
Output is correct |
11 |
Correct |
0 ms |
3040 KB |
Output is correct |
12 |
Correct |
36 ms |
3040 KB |
Output is correct |
13 |
Correct |
20 ms |
3040 KB |
Output is correct |
14 |
Correct |
32 ms |
3040 KB |
Output is correct |
15 |
Correct |
32 ms |
3040 KB |
Output is correct |