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

#TimeUsernameProblemLanguageResultExecution timeMemory
349641eric00513Quality Of Living (IOI10_quality)C++98
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MAX = 3003; int a[MAX][MAX], r, c, h, w; int t[MAX][MAX], pfx[MAX][MAX]; int getval(int x) { return x ? x / abs(x) : 0; } int check(int x) { int i, j; for (i = 1; i <= r; i++) for (j = 1; j <= c; j++) t[i][j] = getval(a[i][j]); for (i = 1; i <= r; i++) for (j = 1; j <= c; j++) pfx[i][j] = pfx[i - 1][j] + pfx[i][j - 1] - pfx[i - 1][j - 1] + t[i][j]; for (i = 1; i <= r - (h - 1); i++) for (j = 1; j <= c - (w - 1); j++) { int ki = i + h - 1, kj = j + w - 1; int val = pfx[ki][kj] - pfx[ki][j - 1] - pfx[i - 1][kj] + pfx[i - 1][j - 1]; if (val == 0) return 0; else if (val < 0) return -1; } return 1; } int main(void) { int i, j; scanf("%d %d %d %d", &r, &c, &h, &w); for (i = 1; i <= r; i++) for (j = 1; j <= c; j++) scanf("%d", &a[i][j]); int lo = 1, hi = r * c, mid; while (true) { mid = (lo + hi) / 2; int res = check(mid); if (res == 0) break; if (res == 1) lo = mid + 1; else hi = mid - 1; } printf("%d", mid); return 0; }

Compilation message (stderr)

quality.cpp: In function 'int main()':
quality.cpp:42:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   42 |  scanf("%d %d %d %d", &r, &c, &h, &w);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
quality.cpp:46:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   46 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
/tmp/ccgqMfjf.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccRgphxX.o:quality.cpp:(.text.startup+0x0): first defined here
/tmp/ccgqMfjf.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