# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480717 | Mackerel_Pike | The Kingdom of JOIOI (JOI17_joioi) | C++14 | 628 ms | 54936 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;
const int maxn = 2005;
int n, m, mn, mx;
int a[maxn][maxn];
int l[maxn], r[maxn];
inline bool solve(int md){
for(int i = 0; i < n; ++i){
for(r[i] = -1; r[i] + 1 < m && a[i][r[i] + 1] >= mx - md; ++r[i]);
for(l[i] = m; l[i] - 1 >= 0 && a[i][l[i] - 1] <= mn + md; --l[i]);
--l[i];
if(l[i] > r[i])
return false;
}
int lst = -1; bool ok = true;
for(int i = 0; i < n; ++i){
lst = max(lst, l[i]);
ok &= (lst <= r[i]);
}
if(ok)
return true;
lst = m;
for(int i = 0; i < n; ++i){
lst = min(lst, r[i]);
if(lst < l[i])
return false;
Compilation message (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... |