# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
12071 |
2014-12-20T20:57:08 Z |
ainta |
격자 보존하기 (GA9_preserve) |
C++ |
|
28 ms |
1876 KB |
#include<stdio.h>
#include<algorithm>
using namespace std;
int C1, C2, C[101000], w[101000];
int L, n, K, Res;
void Do(int S, int m){
if (m < 0)return;
int i;
for (i = n - 1; i >= 1; i--){
m -= 2;
if (m < 0)break;
S += C[i];
}
if (Res < S)Res = S;
}
int main()
{
int i;
scanf("%d%d%d", &L, &n, &K);
for (i = 1; i <= n; i++){
scanf("%d", &w[i]);
}
C1 = w[1] - 1;
C2 = L - w[n];
for (i = 1; i < n; i++){
C[i] = w[i + 1] - w[i] - 1;
}
sort(C + 1, C + n);
if (C1 > C2)swap(C1, C2);
Do(0,K);
Do(C2, K - 1);
Do(C1 + C2, K - 2);
printf("%d\n", Res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1876 KB |
Output is correct |
2 |
Correct |
0 ms |
1876 KB |
Output is correct |
3 |
Correct |
0 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
1876 KB |
Output is correct |
5 |
Correct |
0 ms |
1876 KB |
Output is correct |
6 |
Correct |
0 ms |
1876 KB |
Output is correct |
7 |
Correct |
0 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
1876 KB |
Output is correct |
9 |
Correct |
0 ms |
1876 KB |
Output is correct |
10 |
Correct |
0 ms |
1876 KB |
Output is correct |
11 |
Correct |
0 ms |
1876 KB |
Output is correct |
12 |
Correct |
0 ms |
1876 KB |
Output is correct |
13 |
Correct |
0 ms |
1876 KB |
Output is correct |
14 |
Correct |
0 ms |
1876 KB |
Output is correct |
15 |
Correct |
0 ms |
1876 KB |
Output is correct |
16 |
Correct |
0 ms |
1876 KB |
Output is correct |
17 |
Correct |
0 ms |
1876 KB |
Output is correct |
18 |
Correct |
0 ms |
1876 KB |
Output is correct |
19 |
Correct |
0 ms |
1876 KB |
Output is correct |
20 |
Correct |
0 ms |
1876 KB |
Output is correct |
21 |
Correct |
0 ms |
1876 KB |
Output is correct |
22 |
Correct |
0 ms |
1876 KB |
Output is correct |
23 |
Correct |
0 ms |
1876 KB |
Output is correct |
24 |
Correct |
0 ms |
1876 KB |
Output is correct |
25 |
Correct |
0 ms |
1876 KB |
Output is correct |
26 |
Correct |
0 ms |
1876 KB |
Output is correct |
27 |
Correct |
0 ms |
1876 KB |
Output is correct |
28 |
Correct |
0 ms |
1876 KB |
Output is correct |
29 |
Correct |
0 ms |
1876 KB |
Output is correct |
30 |
Correct |
0 ms |
1876 KB |
Output is correct |
31 |
Correct |
0 ms |
1876 KB |
Output is correct |
32 |
Correct |
0 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1876 KB |
Output is correct |
2 |
Correct |
0 ms |
1876 KB |
Output is correct |
3 |
Correct |
0 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
1876 KB |
Output is correct |
5 |
Correct |
0 ms |
1876 KB |
Output is correct |
6 |
Correct |
0 ms |
1876 KB |
Output is correct |
7 |
Correct |
0 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
1876 KB |
Output is correct |
9 |
Correct |
0 ms |
1876 KB |
Output is correct |
10 |
Correct |
0 ms |
1876 KB |
Output is correct |
11 |
Correct |
0 ms |
1876 KB |
Output is correct |
12 |
Correct |
0 ms |
1876 KB |
Output is correct |
13 |
Correct |
0 ms |
1876 KB |
Output is correct |
14 |
Correct |
0 ms |
1876 KB |
Output is correct |
15 |
Correct |
0 ms |
1876 KB |
Output is correct |
16 |
Correct |
0 ms |
1876 KB |
Output is correct |
17 |
Correct |
0 ms |
1876 KB |
Output is correct |
18 |
Correct |
0 ms |
1876 KB |
Output is correct |
19 |
Correct |
0 ms |
1876 KB |
Output is correct |
20 |
Correct |
0 ms |
1876 KB |
Output is correct |
21 |
Correct |
0 ms |
1876 KB |
Output is correct |
22 |
Correct |
0 ms |
1876 KB |
Output is correct |
23 |
Correct |
0 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1876 KB |
Output is correct |
2 |
Correct |
0 ms |
1876 KB |
Output is correct |
3 |
Correct |
0 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
1876 KB |
Output is correct |
5 |
Correct |
0 ms |
1876 KB |
Output is correct |
6 |
Correct |
0 ms |
1876 KB |
Output is correct |
7 |
Correct |
0 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
1876 KB |
Output is correct |
9 |
Correct |
0 ms |
1876 KB |
Output is correct |
10 |
Correct |
0 ms |
1876 KB |
Output is correct |
11 |
Correct |
0 ms |
1876 KB |
Output is correct |
12 |
Correct |
0 ms |
1876 KB |
Output is correct |
13 |
Correct |
0 ms |
1876 KB |
Output is correct |
14 |
Correct |
0 ms |
1876 KB |
Output is correct |
15 |
Correct |
0 ms |
1876 KB |
Output is correct |
16 |
Correct |
0 ms |
1876 KB |
Output is correct |
17 |
Correct |
0 ms |
1876 KB |
Output is correct |
18 |
Correct |
0 ms |
1876 KB |
Output is correct |
19 |
Correct |
0 ms |
1876 KB |
Output is correct |
20 |
Correct |
0 ms |
1876 KB |
Output is correct |
21 |
Correct |
0 ms |
1876 KB |
Output is correct |
22 |
Correct |
0 ms |
1876 KB |
Output is correct |
23 |
Correct |
0 ms |
1876 KB |
Output is correct |
24 |
Correct |
0 ms |
1876 KB |
Output is correct |
25 |
Correct |
0 ms |
1876 KB |
Output is correct |
26 |
Correct |
0 ms |
1876 KB |
Output is correct |
27 |
Correct |
0 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1876 KB |
Output is correct |
2 |
Correct |
24 ms |
1876 KB |
Output is correct |
3 |
Correct |
24 ms |
1876 KB |
Output is correct |
4 |
Correct |
20 ms |
1876 KB |
Output is correct |
5 |
Correct |
20 ms |
1876 KB |
Output is correct |
6 |
Correct |
28 ms |
1876 KB |
Output is correct |
7 |
Correct |
24 ms |
1876 KB |
Output is correct |
8 |
Correct |
24 ms |
1876 KB |
Output is correct |
9 |
Correct |
12 ms |
1876 KB |
Output is correct |
10 |
Correct |
8 ms |
1876 KB |
Output is correct |
11 |
Correct |
24 ms |
1876 KB |
Output is correct |
12 |
Correct |
24 ms |
1876 KB |
Output is correct |
13 |
Correct |
24 ms |
1876 KB |
Output is correct |
14 |
Correct |
20 ms |
1876 KB |
Output is correct |
15 |
Correct |
24 ms |
1876 KB |
Output is correct |
16 |
Correct |
24 ms |
1876 KB |
Output is correct |
17 |
Correct |
24 ms |
1876 KB |
Output is correct |
18 |
Correct |
20 ms |
1876 KB |
Output is correct |
19 |
Correct |
24 ms |
1876 KB |
Output is correct |
20 |
Correct |
0 ms |
1876 KB |
Output is correct |
21 |
Correct |
0 ms |
1876 KB |
Output is correct |
22 |
Correct |
24 ms |
1876 KB |
Output is correct |
23 |
Correct |
16 ms |
1876 KB |
Output is correct |
24 |
Correct |
20 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1876 KB |
Output is correct |
2 |
Correct |
24 ms |
1876 KB |
Output is correct |
3 |
Correct |
20 ms |
1876 KB |
Output is correct |
4 |
Correct |
16 ms |
1876 KB |
Output is correct |
5 |
Correct |
24 ms |
1876 KB |
Output is correct |
6 |
Correct |
20 ms |
1876 KB |
Output is correct |
7 |
Correct |
20 ms |
1876 KB |
Output is correct |
8 |
Correct |
20 ms |
1876 KB |
Output is correct |
9 |
Correct |
16 ms |
1876 KB |
Output is correct |
10 |
Correct |
8 ms |
1876 KB |
Output is correct |
11 |
Correct |
12 ms |
1876 KB |
Output is correct |
12 |
Correct |
12 ms |
1876 KB |
Output is correct |
13 |
Correct |
24 ms |
1876 KB |
Output is correct |
14 |
Correct |
20 ms |
1876 KB |
Output is correct |
15 |
Correct |
16 ms |
1876 KB |
Output is correct |
16 |
Correct |
20 ms |
1876 KB |
Output is correct |
17 |
Correct |
24 ms |
1876 KB |
Output is correct |
18 |
Correct |
20 ms |
1876 KB |
Output is correct |
19 |
Correct |
20 ms |
1876 KB |
Output is correct |
20 |
Correct |
16 ms |
1876 KB |
Output is correct |