# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107043 | Diuven | Watching (JOI13_watching) | C++14 | 213 ms | 16248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
int n, p, q, A[2010];
int f(int x){
if(x<1) return 0;
// A에서 x이하인 최대 인덱스. 없으면 0
int pos = upper_bound(A+1, A+n+1, x) - A - 1;
return pos;
}
inline int _min(int x, int y){ return x<y ? x : y; }
bool check(lint x){
static int D[2010][2010], E[2010], F[2010];
for(int i=1; i<=n; i++){
E[i] = f(A[i] - x);
F[i] = f(A[i] - 2*x);
}
for(int i=1; i<=n; i++) D[0][i] = 0;
for(int i=1; i<=n; i++){
int s = E[i], l = F[i];
D[i][0] = D[l][0] + 1;
for(int j=1; j<=n; j++)
D[i][j] = _min(D[s][j-1], D[l][j]+1);
}
// cout<<"SOLVE: "<<x<<'\n';
// for(int i=1; i<=n; i++, cout<<'\n') for(int j=1; j<=n; j++) cout<<D[i][j]<<' ';
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |