# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
109934 | cgiosy | 구경하기 (JOI13_watching) | C++17 | 159 ms | 8440 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
inline short min(const short x, const short y) { return x<y ? x : y; }
int a[2048], tx, ty; short d[2048][2048], n, x, y;
int main() {
scanf("%hd%d%d", &n, &tx, &ty);
y=ty<n?ty:n; x=tx<n-y?tx:n-y;
for(short i=1; i<=n; i++) scanf("%d", a+i);
std::sort(a+1, a+n+1);
int l=1, r=a[n]-a[1]+1;
while(l<r) {
int m=(l+r)/2, p=1, q=1;
for(short i=1; i<=n; i++) {
while(p<=i && a[p]<=a[i]-m) p++;
while(q<=i && a[q]<=a[i]-2*m) q++;
d[i][0]=d[q-1][0]+1;
for(short j=1; j<=i && j<=x; j++) d[i][j]=min(d[p-1][j-1], d[q-1][j]+1);
}
if(d[n][x]<=y) r=m;
else l=m+1;
}
printf("%d", r);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |