# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
12806 |
2015-01-04T08:40:58 Z |
qja0950 |
Friend (IOI14_friend) |
C++ |
|
36 ms |
3048 KB |
#include "friend.h"
#include <algorithm>
using namespace std;
#define MAX_N 101101
int N;
int Dy[MAX_N][2];
int findSample(int n,int confidence[],int host[],int protocol[]) {
N = n;
for(int i=0; i<N; i++)
Dy[i][1] = confidence[i];
for(int i=N; i>=1; i--) {
int p = protocol[i];
int h = host[i];
int i0 = Dy[i][0], i1 = Dy[i][1];
int h0 = Dy[h][0], h1 = Dy[h][1];
if(p == 0) {
Dy[h][0] += max(i0, i1);
Dy[h][1] += i0;
}else if(p == 1) {
Dy[h][0] += i0;
Dy[h][1] = max(h1 + i1, max(h1 + i0, h0 + i1) );
}else if(p == 2) {
Dy[h][0] += i0;
Dy[h][1] = max(h1 + i0, h0 + i1);
}
}
return max(Dy[0][0], Dy[0][1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
11 |
Correct |
0 ms |
3048 KB |
Output is correct |
12 |
Correct |
0 ms |
3048 KB |
Output is correct |
13 |
Correct |
0 ms |
3048 KB |
Output is correct |
14 |
Correct |
0 ms |
3048 KB |
Output is correct |
15 |
Correct |
0 ms |
3048 KB |
Output is correct |
16 |
Correct |
0 ms |
3048 KB |
Output is correct |
17 |
Correct |
0 ms |
3048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
11 |
Correct |
0 ms |
3048 KB |
Output is correct |
12 |
Correct |
0 ms |
3048 KB |
Output is correct |
13 |
Correct |
0 ms |
3048 KB |
Output is correct |
14 |
Correct |
0 ms |
3048 KB |
Output is correct |
15 |
Correct |
0 ms |
3048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
11 |
Correct |
0 ms |
3048 KB |
Output is correct |
12 |
Correct |
0 ms |
3048 KB |
Output is correct |
13 |
Correct |
0 ms |
3048 KB |
Output is correct |
14 |
Correct |
0 ms |
3048 KB |
Output is correct |
15 |
Correct |
0 ms |
3048 KB |
Output is correct |
16 |
Correct |
0 ms |
3048 KB |
Output is correct |
17 |
Correct |
0 ms |
3048 KB |
Output is correct |
18 |
Correct |
0 ms |
3048 KB |
Output is correct |
19 |
Correct |
0 ms |
3048 KB |
Output is correct |
20 |
Correct |
0 ms |
3048 KB |
Output is correct |
21 |
Correct |
0 ms |
3048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3048 KB |
Output is correct |
2 |
Correct |
0 ms |
3048 KB |
Output is correct |
3 |
Correct |
0 ms |
3048 KB |
Output is correct |
4 |
Correct |
0 ms |
3048 KB |
Output is correct |
5 |
Correct |
0 ms |
3048 KB |
Output is correct |
6 |
Correct |
0 ms |
3048 KB |
Output is correct |
7 |
Correct |
0 ms |
3048 KB |
Output is correct |
8 |
Correct |
0 ms |
3048 KB |
Output is correct |
9 |
Correct |
0 ms |
3048 KB |
Output is correct |
10 |
Correct |
0 ms |
3048 KB |
Output is correct |
11 |
Correct |
0 ms |
3048 KB |
Output is correct |
12 |
Correct |
36 ms |
3048 KB |
Output is correct |
13 |
Correct |
12 ms |
3048 KB |
Output is correct |
14 |
Correct |
32 ms |
3048 KB |
Output is correct |
15 |
Correct |
28 ms |
3048 KB |
Output is correct |