# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92120 | 2019-01-01T15:10:19 Z | tjrwodnjs999 | 격자 보존하기 (GA9_preserve) | C++11 | 25 ms | 2908 KB |
#include <bits/stdc++.h> using namespace std; int n,m,k,arr[100005],a[100005],b[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=0;i<m-1;i++) a[i]=arr[i+1]-arr[i]-1; sort(a,a+100005,greater<int>()); b[0]=a[0]; for(int i=1;i<m-1;i++) b[i]+=b[i-1]; if(k==1) Max=max(arr[0]-1,n-arr[m-1]); else{ Max=b[k/2-1]; if(k>=3) Max=max(Max,b[(k-1)/2-1]+max(arr[0]-1,n-arr[m-1])); if(k>=4) Max=max(Max,b[(k-2)/2-1]+arr[0]-1+n-arr[m-1]); } printf("%d",Max); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 760 KB | Output is correct |
2 | Correct | 3 ms | 760 KB | Output is correct |
3 | Correct | 3 ms | 760 KB | Output is correct |
4 | Correct | 3 ms | 760 KB | Output is correct |
5 | Incorrect | 3 ms | 760 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 760 KB | Output is correct |
2 | Correct | 3 ms | 760 KB | Output is correct |
3 | Correct | 3 ms | 760 KB | Output is correct |
4 | Correct | 3 ms | 760 KB | Output is correct |
5 | Correct | 3 ms | 760 KB | Output is correct |
6 | Correct | 3 ms | 760 KB | Output is correct |
7 | Correct | 3 ms | 760 KB | Output is correct |
8 | Correct | 3 ms | 636 KB | Output is correct |
9 | Correct | 3 ms | 760 KB | Output is correct |
10 | Correct | 3 ms | 760 KB | Output is correct |
11 | Correct | 3 ms | 760 KB | Output is correct |
12 | Correct | 3 ms | 760 KB | Output is correct |
13 | Correct | 3 ms | 760 KB | Output is correct |
14 | Correct | 3 ms | 760 KB | Output is correct |
15 | Correct | 3 ms | 760 KB | Output is correct |
16 | Correct | 3 ms | 760 KB | Output is correct |
17 | Correct | 3 ms | 732 KB | Output is correct |
18 | Correct | 3 ms | 760 KB | Output is correct |
19 | Incorrect | 3 ms | 760 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 25 ms | 2908 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |