# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109893 | 2019-05-08T10:48:01 Z | cgiosy | Watching (JOI13_watching) | C++17 | 52 ms | 24696 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, a+n+1); int l=0, r=1e9; while(l<r) { int m=(l+r)/2, p=1, q=1; memset(d[1], 0x3f, 2047*2048*2); rep(i, 1, n) { while(a[p]<=a[i]-m) p++; while(a[q]<=a[i]-2*m) q++; rep(j, 1, x) d[i][j]=std::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); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 8576 KB | Output is correct |
2 | Runtime error | 42 ms | 16760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 52 ms | 24696 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |