# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109898 | 2019-05-08T11:02:33 Z | cgiosy | Watching (JOI13_watching) | C++17 | 187 ms | 16392 KB |
#include <cstdio> #include <cstring> #include <algorithm> #define rep(i,x,n) for(int i=x; i<=n; i++) int a[2048], d[2048][2048], n, x, y; int main() { scanf("%d%d%d", &n, &x, &y); if(n<x) x=n; rep(i, 1, n) 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=0, q=0; rep(i, 0, n) { while(p<=i && a[p]<=a[i]-m) p++; while(p<=i && a[q]<=a[i]-2*m) q++; rep(j, !i, x) d[i][j]=i ? j ? std::min(d[p-1][j-1], d[q-1][j]+1) : d[q-1][j]+1 : n; } if(d[n][x]<=y) r=m; else l=m+1; } printf("%d", r); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 768 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Incorrect | 4 ms | 640 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 8320 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Incorrect | 187 ms | 16392 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |