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

#TimeUsernameProblemLanguageResultExecution timeMemory
861098biximoQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int r, c, h, w; int grid[3005][3005], pref[3005][3005]; int query(int x1, int y1) { int x2 = x1 + h - 1, y2 = y1 + w - 1; return pref[x2][y2] + pref[x1 - 1][y1 - 1] - pref[x1 - 1][y2] - pref[x2][y1 - 1]; } bool check(int m) { for(auto&i: pref) for(auto&j: i) j = 0; // cout << m << "\n"; for(int i = 1; i <= r; i ++) { for(int j = 1; j <= c; j ++) { pref[i][j] = (grid[i][j] <= m) + pref[i][j - 1] + pref[i - 1][j] - pref[i - 1][j - 1]; // cout << pref[i][j] << " "; } // cout << "\n"; } // cout << "\n"; for(int i = 1; i <= c - h + 1; i ++) { for(int j = 1; j <= (c - w + 1); j ++) { if(query(i, j) * 2 >= h * w) return true; } } return false; } int main() { cin.tie(0)->sync_with_stdio(0); cin >> r >> c >> h >> w; for(int i = 1; i <= r; i ++) for(int j = 1; j <= c; j ++) { cin >> grid[i][j]; } int low = 1, high = r * c, ans; while(low <= high) { int mid = (low + high) >> 1; if(check(mid)) { high = mid - 1; ans = mid; } else { low = mid + 1; } } cout << ans; }

Compilation message (stderr)

quality.cpp: In function 'int main()':
quality.cpp:43:13: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |     cout << ans;
      |             ^~~
/usr/bin/ld: /tmp/ccs9jRlX.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc83vvAZ.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccs9jRlX.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status