# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92115 | 2019-01-01T15:01:30 Z | tjrwodnjs999 | 격자 보존하기 (GA9_preserve) | C++11 | 24 ms | 2544 KB |
#include <bits/stdc++.h> using namespace std; int n,m,k,arr[100005],Max,sum; vector<int> vt; 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++) vt.push_back(arr[i+1]-arr[i]-1); sort(vt.begin(),vt.end(),greater<int>()); for(int i=0;i<k/2;i++) sum+=vt[i]; Max=sum; sum=0; for(int i=0;i<(k-1)/2;i++) sum+=vt[i]; Max=max(Max,sum+max(arr[0]-1,n-arr[m-1])); if(k>=2){ sum=arr[0]-1; sum+=n-arr[m-1]; for(int i=0;i<(k-2)/2;i++) sum+=vt[i]; Max=max(Max,sum); } printf("%d",Max); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 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 | 256 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Incorrect | 1 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 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 | 1 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 380 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 | 380 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 2 ms | 376 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 | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 380 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 256 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
21 | Correct | 2 ms | 256 KB | Output is correct |
22 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
27 | Correct | 0 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 1652 KB | Output is correct |
2 | Correct | 24 ms | 1524 KB | Output is correct |
3 | Correct | 23 ms | 1524 KB | Output is correct |
4 | Correct | 22 ms | 1524 KB | Output is correct |
5 | Correct | 23 ms | 1524 KB | Output is correct |
6 | Correct | 22 ms | 1524 KB | Output is correct |
7 | Correct | 23 ms | 1524 KB | Output is correct |
8 | Correct | 23 ms | 1520 KB | Output is correct |
9 | Correct | 13 ms | 1144 KB | Output is correct |
10 | Correct | 8 ms | 888 KB | Output is correct |
11 | Correct | 21 ms | 1524 KB | Output is correct |
12 | Correct | 22 ms | 1524 KB | Output is correct |
13 | Correct | 21 ms | 1524 KB | Output is correct |
14 | Correct | 21 ms | 1520 KB | Output is correct |
15 | Correct | 23 ms | 1524 KB | Output is correct |
16 | Correct | 22 ms | 1524 KB | Output is correct |
17 | Correct | 21 ms | 1520 KB | Output is correct |
18 | Correct | 21 ms | 1580 KB | Output is correct |
19 | Correct | 21 ms | 1528 KB | Output is correct |
20 | Correct | 2 ms | 256 KB | Output is correct |
21 | Correct | 2 ms | 376 KB | Output is correct |
22 | Correct | 20 ms | 1524 KB | Output is correct |
23 | Correct | 22 ms | 1524 KB | Output is correct |
24 | Correct | 20 ms | 1524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 24 ms | 2544 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |