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

#TimeUsernameProblemLanguageResultExecution timeMemory
805275QwertyPiQuality Of Living (IOI10_quality)C++14
100 / 100
1054 ms140164 KiB
#include <bits/stdc++.h> using namespace std; int ps[3001][3001]; int sum(int x1, int x2, int y1, int y2){ return ps[x2 + 1][y2 + 1] - ps[x2 + 1][y1] - ps[x1][y2 + 1] + ps[x1][y1]; } bool ok(int R, int C, int H, int W, int Q[3001][3001], int x){ for(int i = 0; i < R; i++){ for(int j = 0; j < C; j++){ ps[i + 1][j + 1] = ps[i + 1][j] + ps[i][j + 1] - ps[i][j] + (Q[i][j] <= x); } } for(int i = 0; i <= R - H; i++){ for(int j = 0; j <= C - W; j++){ if(sum(i, i + H - 1, j, j + W - 1) >= (H * W + 1) / 2){ return true; } } } return false; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]){ int lo = 1, hi = R * C; while(lo != hi){ int mid = (lo + hi) / 2; if(ok(R, C, H, W, Q, mid)){ hi = mid; }else{ lo = mid + 1; } } return lo; }
#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...