(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 #309975

#TimeUsernameProblemLanguageResultExecution timeMemory
309975sofapudenQuality Of Living (IOI10_quality)C++14
100 / 100
4364 ms140520 KiB
#include "quality.h" #include <bits/stdc++.h> using namespace std; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int l = 0, r = R*C; int good; while(l < r){ int mid = (l+r+1)/2; vector<vector<int>> gri(R,vector<int>(C)); for(int i = 0; i < R; ++i){ for(int j = 0; j < C; ++j){ if(Q[i][j] < mid) gri[i][j] = -1; if(Q[i][j] > mid) gri[i][j] = 1; if(Q[i][j] == mid) gri[i][j] = 0; if(i)gri[i][j]+=gri[i-1][j]; if(j)gri[i][j]+=gri[i][j-1]; if(i && j)gri[i][j]-=gri[i-1][j-1]; } } int best = INT_MAX; for(int i = H-1; i < R; ++i){ for(int j = W-1; j < C; ++j){ int now = gri[i][j]; if(i >= H)now-=gri[i-H][j]; if(j >= W)now-=gri[i][j-W]; if(i >= H && j >= W)now+=gri[i-H][j-W]; best = min(best,now); } } if(best <= 0){r = mid-1;good = mid;} else l = mid; } return good; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:35:9: warning: 'good' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |  return good;
      |         ^~~~
#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...