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

#TimeUsernameProblemLanguageResultExecution timeMemory
734890phoebeQuality Of Living (IOI10_quality)C++17
100 / 100
1761 ms122328 KiB
#include <bits/stdc++.h> #include "quality.h" using namespace std; int prefix[3001][3001] = {0}; int rectangle(int R, int C, int H, int W, int Q[3001][3001]){ int l = 0, r = 3001 * 3001, ans; while (l <= r){ int mid = (l + r) / 2; for (int i = 1; i <= R; i++){ for (int j = 1; j <= C; j++){ if (Q[i - 1][j - 1] <= mid) prefix[i][j] = 1; else prefix[i][j] = -1; prefix[i][j] += prefix[i][j - 1]; } } for (int i = 1; i <= R; i++){ for (int j = 1; j <= C; j++) prefix[i][j] += prefix[i - 1][j]; } bool pos = false; for (int i = H; i <= R; i++){ for (int j = W; j <= C; j++){ int val = prefix[i][j] - prefix[i - H][j] - prefix[i][j - W] + prefix[i - H][j - W]; if (val > 0) pos = true; } } if (pos) ans = mid, r = mid - 1; else l = mid + 1; } return ans; }

Compilation message (stderr)

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