# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388741 | Pichon5 | Quality Of Living (IOI10_quality) | C++17 | 5091 ms | 3808 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 "quality.h"
#include <bits/stdc++.h>
#define vi vector<vi>
#define ll long long int
#define pb push_back
using namespace std;
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
//R rows
//C columns
// H de hight
//W de weihght
int M[3001][3001];
for(int i=1;i<=R*C;i++){
for(int j=0;j<R;j++){
for(int k=0;k<C;k++){
M[j][k]=0;
if(Q[j][k]>i)M[j][k]=1;
if(Q[j][k]<i)M[j][k]=-1;
}
}
for(int j=0;j<R;j++){
for(int k=0;k<C;k++){
if(j)M[j][k]+=M[j-1][k];
if(k)M[j][k]+=M[j][k-1];
if(j>0 && k>0)M[j][k]-=M[j-1][k-1];
}
}
for(int j=0;j+H<=R;j++){
for(int k=0;k+W<=C;k++){
int sum=M[j+H-1][k+W-1];
if(j)sum-=M[j-1][k+W-1];
if(k)sum-=M[j+H-1][k-1];
if(j>0 && k>0)sum+=M[j-1][k-1];
if(sum==0){
return 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |