# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172584 | songc | The Kingdom of JOIOI (JOI17_joioi) | C++14 | 1101 ms | 26248 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 LL;
typedef pair<int,int> pii;
int N, M, ans;
int gm=1234567890, mx, my;
int A[2020][2020];
int P[2020];
bool chk(int k){
for (int i=1; i<=N; i++) for (P[i]=0; A[i][P[i]+1]-gm<=k && P[i]<M; P[i]++);
int Max=0, Min=1234567890, t=M;
for (int i=1; i<=N; i++){
t = min(t, P[i]);
if (i==mx && t<my){
Max = 1234567890;
Min = 0;
break;
}
for (int j=t+1; j<=M; j++){
Max = max(Max, A[i][j]);
Min = min(Min, A[i][j]);
}
}
if (Max-Min <= k) return true;
Max=0, Min=1234567890, t=M;
for (int i=N; i>=1; i--){
t = min(t, P[i]);
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... |