Submission #512662

#TimeUsernameProblemLanguageResultExecution timeMemory
512662saralQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include "quality.h" const int N = 3010; int pom[N][N]; bool check (int x, int n, int m, int h, int w) { memset (pom, 0, sizeof(pom)); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (a[i][j] <= x) pom[i][j] = 1; pom[i][j] = pom[i][j]+pom[i-1][j]+pom[i][j-1]-pom[i-1][j-1]; } } /*for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cout << pom[i][j] << " "; } cout << endl; }*/ for (int i = h; i <= n; i++) { for (int j = w; j <= m; j++) { int val = pom[i][j]-pom[i-h][j]-pom[i][j-w]+pom[i-h][j-w]; if (val >= (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, mid; while (lo < hi) { mid = (lo+hi)/2; if (check(mid, R, C, H, W)) { hi = mid; } else { lo = mid+1; } } return lo; }

Compilation message (stderr)

quality.cpp: In function 'bool check(int, int, int, int, int)':
quality.cpp:6:2: error: 'memset' was not declared in this scope
    6 |  memset (pom, 0, sizeof(pom));
      |  ^~~~~~
quality.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "quality.h"
  +++ |+#include <cstring>
    2 | const int N = 3010;
quality.cpp:9:8: error: 'a' was not declared in this scope
    9 |    if (a[i][j] <= x) pom[i][j] = 1;
      |        ^