Submission #92125

# Submission time Handle Problem Language Result Execution time Memory
92125 2019-01-01T15:26:11 Z tjrwodnjs999 격자 보존하기 (GA9_preserve) C++11
56 / 100
23 ms 2040 KB
#include <bits/stdc++.h>
using namespace std;
int n,m,k,arr[100005],a[100005],Max,sum;
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<m;i++) scanf("%d",&arr[i]);
    for(int i=1;i<m;i++) a[i]=arr[i]-arr[i-1]-1;
    sort(a+1,a+m,greater<int>());
    for(int i=1;i<m;i++) a[i]+=a[i-1];
    if(k==1) Max=max(arr[0]-1,n-arr[m-1]);
    else if(k%2) Max=max(a[k/2]+max(arr[0]-1,n-arr[m-1]),a[k/2-1]+arr[0]-1+n-arr[m-1]);
    else Max=max(a[k/2],a[k/2-1]+arr[0]-1+n-arr[m-1]);
    printf("%d",Max);
}

Compilation message

preserve.cpp: In function 'int main()':
preserve.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d",&n,&m,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~
preserve.cpp:7:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<m;i++) scanf("%d",&arr[i]);
                          ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 380 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1144 KB Output is correct
2 Correct 22 ms 1116 KB Output is correct
3 Correct 23 ms 1144 KB Output is correct
4 Correct 23 ms 1084 KB Output is correct
5 Correct 23 ms 1016 KB Output is correct
6 Correct 23 ms 1144 KB Output is correct
7 Correct 22 ms 1144 KB Output is correct
8 Correct 22 ms 1144 KB Output is correct
9 Correct 12 ms 760 KB Output is correct
10 Correct 8 ms 632 KB Output is correct
11 Correct 22 ms 1144 KB Output is correct
12 Correct 21 ms 1144 KB Output is correct
13 Correct 22 ms 1016 KB Output is correct
14 Correct 20 ms 1144 KB Output is correct
15 Correct 22 ms 1144 KB Output is correct
16 Correct 22 ms 1144 KB Output is correct
17 Correct 21 ms 1144 KB Output is correct
18 Correct 22 ms 1016 KB Output is correct
19 Correct 22 ms 1144 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 21 ms 1144 KB Output is correct
23 Correct 22 ms 1172 KB Output is correct
24 Correct 20 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 23 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -