| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 92124 | tjrwodnjs999 | 격자 보존하기 (GA9_preserve) | C++11 | 24 ms | 2936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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=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++) b[i]+=b[i-1]+a[i];
if(k==1) Max=max(arr[0]-1,n-arr[m-1]);
else if(k%2) Max=max(b[k/2]+max(arr[0]-1,n-arr[m-1]),b[k/2-1]+arr[0]-1+n-arr[m-1]);
else Max=max(b[k/2],b[k/2-1]+arr[0]-1+n-arr[m-1]);
printf("%d",Max);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
