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

#TimeUsernameProblemLanguageResultExecution timeMemory
1091523dylanliangQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; bool medianExists(int const& mid, vector<vector<int>> grid, int const& r, int const& c, int const& h, int const& w) { for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) { if (mid > grid[i][j]) { grid[i][j] = -1; } else if (mid < grid[i][j]) { grid[i][j] = 1; } else { grid[i][j] = 0; } } } int count = 0; for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { count += grid[i][j]; } } if (count <= 0) return true; bool movingRight = true; for (int i = 0; i < r-h; ++i) { if (movingRight) { for (int j = 0; j < c-w; ++j) { for (int k = i; k < i+h; ++k) { count += grid[k][j+w] - grid[k][j]; } } if (count <= 0) return true; for (int j = c-w-1; j < c; ++j) { count += grid[i+h][j] - grid[i][j]; } if (count <= 0) return true; } else { for (int j = c-w-1; j >= 0; --j) { for (int k = i; k < i+h; ++k) { count += grid[k][j] - grid[k][j+w]; } } if (count <= 0) return true; for (int j = 0; j < w; ++j) { count += grid[i+h][j] - grid[i][j]; } if (count <= 0) return true; } movingRight = not movingRight; } return false; } int main() { int r, c, h, w; cin >> r >> c >> h >> w; vector<vector<int>> grid(r, vector<int>(c, 0)); for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) { cin >> grid[i][j]; } } int lo = 1; int hi = r*c; while (lo < hi) { int mid = (lo + hi) / 2; if (medianExists(mid, grid, r, c, h, w)) { hi = mid; } else { lo = mid+1; } } cout << (lo+hi) / 2; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc6kWDGD.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc2DCFFD.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc6kWDGD.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