#include <cstdio>
#include <algorithm>
using namespace std;
int n, k, d;
int data [100010];
int cnv_data[100010];
int get(bool f1,bool f2)
{
int divs = d-f1-f2;
int ret=0;
if(f1) ret+=cnv_data[0];
if(f2) ret+=cnv_data[k];
divs/=2;
int i;
for(i=k-1;i>=k-divs && i>=1;--i){
ret+=cnv_data[i];
}
return ret;
}
int main()
{
scanf("%d%d%d",&n,&k,&d);
int i;
for(i=0;i<k;++i) scanf("%d",data+i);
sort(data,data+k);
int ind=0;
cnv_data[0]=data[0]-1;
for(i=1;i<k;++i){
cnv_data[i]=data[i]-data[i-1]-1;
}
cnv_data[k]=n-data[k-1];
sort(cnv_data+1,cnv_data+k);
int ans=0;
for(i=0;i<4;++i) ans=max(ans,get(i>>1,i&1));
printf("%d\n",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
7 |
Correct |
0 ms |
1868 KB |
Output is correct |
8 |
Correct |
0 ms |
1868 KB |
Output is correct |
9 |
Correct |
0 ms |
1868 KB |
Output is correct |
10 |
Correct |
0 ms |
1868 KB |
Output is correct |
11 |
Correct |
0 ms |
1868 KB |
Output is correct |
12 |
Correct |
0 ms |
1868 KB |
Output is correct |
13 |
Correct |
0 ms |
1868 KB |
Output is correct |
14 |
Correct |
0 ms |
1868 KB |
Output is correct |
15 |
Correct |
0 ms |
1868 KB |
Output is correct |
16 |
Correct |
0 ms |
1868 KB |
Output is correct |
17 |
Correct |
0 ms |
1868 KB |
Output is correct |
18 |
Correct |
0 ms |
1868 KB |
Output is correct |
19 |
Correct |
0 ms |
1868 KB |
Output is correct |
20 |
Correct |
0 ms |
1868 KB |
Output is correct |
21 |
Correct |
0 ms |
1868 KB |
Output is correct |
22 |
Correct |
0 ms |
1868 KB |
Output is correct |
23 |
Correct |
0 ms |
1868 KB |
Output is correct |
24 |
Correct |
0 ms |
1868 KB |
Output is correct |
25 |
Correct |
0 ms |
1868 KB |
Output is correct |
26 |
Correct |
0 ms |
1868 KB |
Output is correct |
27 |
Correct |
0 ms |
1868 KB |
Output is correct |
28 |
Correct |
0 ms |
1868 KB |
Output is correct |
29 |
Correct |
0 ms |
1868 KB |
Output is correct |
30 |
Correct |
0 ms |
1868 KB |
Output is correct |
31 |
Correct |
0 ms |
1868 KB |
Output is correct |
32 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
7 |
Correct |
0 ms |
1868 KB |
Output is correct |
8 |
Correct |
0 ms |
1868 KB |
Output is correct |
9 |
Correct |
0 ms |
1868 KB |
Output is correct |
10 |
Correct |
0 ms |
1868 KB |
Output is correct |
11 |
Correct |
0 ms |
1868 KB |
Output is correct |
12 |
Correct |
0 ms |
1868 KB |
Output is correct |
13 |
Correct |
0 ms |
1868 KB |
Output is correct |
14 |
Correct |
0 ms |
1868 KB |
Output is correct |
15 |
Correct |
0 ms |
1868 KB |
Output is correct |
16 |
Correct |
0 ms |
1868 KB |
Output is correct |
17 |
Correct |
0 ms |
1868 KB |
Output is correct |
18 |
Correct |
0 ms |
1868 KB |
Output is correct |
19 |
Correct |
0 ms |
1868 KB |
Output is correct |
20 |
Correct |
0 ms |
1868 KB |
Output is correct |
21 |
Correct |
0 ms |
1868 KB |
Output is correct |
22 |
Correct |
0 ms |
1868 KB |
Output is correct |
23 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
5 |
Correct |
0 ms |
1868 KB |
Output is correct |
6 |
Correct |
0 ms |
1868 KB |
Output is correct |
7 |
Correct |
0 ms |
1868 KB |
Output is correct |
8 |
Correct |
0 ms |
1868 KB |
Output is correct |
9 |
Correct |
0 ms |
1868 KB |
Output is correct |
10 |
Correct |
0 ms |
1868 KB |
Output is correct |
11 |
Correct |
0 ms |
1868 KB |
Output is correct |
12 |
Correct |
0 ms |
1868 KB |
Output is correct |
13 |
Correct |
0 ms |
1868 KB |
Output is correct |
14 |
Correct |
0 ms |
1868 KB |
Output is correct |
15 |
Correct |
0 ms |
1868 KB |
Output is correct |
16 |
Correct |
0 ms |
1868 KB |
Output is correct |
17 |
Correct |
0 ms |
1868 KB |
Output is correct |
18 |
Correct |
0 ms |
1868 KB |
Output is correct |
19 |
Correct |
0 ms |
1868 KB |
Output is correct |
20 |
Correct |
0 ms |
1868 KB |
Output is correct |
21 |
Correct |
0 ms |
1868 KB |
Output is correct |
22 |
Correct |
0 ms |
1868 KB |
Output is correct |
23 |
Correct |
0 ms |
1868 KB |
Output is correct |
24 |
Correct |
0 ms |
1868 KB |
Output is correct |
25 |
Correct |
0 ms |
1868 KB |
Output is correct |
26 |
Correct |
0 ms |
1868 KB |
Output is correct |
27 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1868 KB |
Output is correct |
2 |
Correct |
24 ms |
1868 KB |
Output is correct |
3 |
Correct |
20 ms |
1868 KB |
Output is correct |
4 |
Correct |
24 ms |
1868 KB |
Output is correct |
5 |
Correct |
20 ms |
1868 KB |
Output is correct |
6 |
Correct |
28 ms |
1868 KB |
Output is correct |
7 |
Correct |
20 ms |
1868 KB |
Output is correct |
8 |
Correct |
28 ms |
1868 KB |
Output is correct |
9 |
Correct |
8 ms |
1868 KB |
Output is correct |
10 |
Correct |
8 ms |
1868 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
24 ms |
1868 KB |
Output is correct |
13 |
Correct |
28 ms |
1868 KB |
Output is correct |
14 |
Correct |
28 ms |
1868 KB |
Output is correct |
15 |
Correct |
28 ms |
1868 KB |
Output is correct |
16 |
Correct |
24 ms |
1868 KB |
Output is correct |
17 |
Correct |
24 ms |
1868 KB |
Output is correct |
18 |
Correct |
28 ms |
1868 KB |
Output is correct |
19 |
Correct |
28 ms |
1868 KB |
Output is correct |
20 |
Correct |
0 ms |
1868 KB |
Output is correct |
21 |
Correct |
0 ms |
1868 KB |
Output is correct |
22 |
Correct |
20 ms |
1868 KB |
Output is correct |
23 |
Correct |
28 ms |
1868 KB |
Output is correct |
24 |
Correct |
20 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1868 KB |
Output is correct |
2 |
Correct |
24 ms |
1868 KB |
Output is correct |
3 |
Correct |
28 ms |
1868 KB |
Output is correct |
4 |
Correct |
28 ms |
1868 KB |
Output is correct |
5 |
Correct |
20 ms |
1868 KB |
Output is correct |
6 |
Correct |
20 ms |
1868 KB |
Output is correct |
7 |
Correct |
24 ms |
1868 KB |
Output is correct |
8 |
Correct |
24 ms |
1868 KB |
Output is correct |
9 |
Correct |
16 ms |
1868 KB |
Output is correct |
10 |
Correct |
4 ms |
1868 KB |
Output is correct |
11 |
Correct |
16 ms |
1868 KB |
Output is correct |
12 |
Correct |
24 ms |
1868 KB |
Output is correct |
13 |
Correct |
24 ms |
1868 KB |
Output is correct |
14 |
Correct |
20 ms |
1868 KB |
Output is correct |
15 |
Correct |
20 ms |
1868 KB |
Output is correct |
16 |
Correct |
20 ms |
1868 KB |
Output is correct |
17 |
Correct |
20 ms |
1868 KB |
Output is correct |
18 |
Correct |
16 ms |
1868 KB |
Output is correct |
19 |
Correct |
24 ms |
1868 KB |
Output is correct |
20 |
Correct |
12 ms |
1868 KB |
Output is correct |