(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #388747

#TimeUsernameProblemLanguageResultExecution timeMemory
388747Pichon5Quality Of Living (IOI10_quality)C++17
100 / 100
2450 ms140244 KiB
#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]; int b=1,e=C*R; int res; while(b<=e){ int i=(b+e)/2; 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]; } } bool ok=false; 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)ok=1; } } if(ok){ res=i; e=i-1; }else{ b=i+1; } } return res; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:49:12: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
   49 |     return res;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...