Submission #1296263

#TimeUsernameProblemLanguageResultExecution timeMemory
1296263mihajlo0404Quality Of Living (IOI10_quality)C++20
Compilation error
0 ms0 KiB
typedef long long ll; ll inf = 2000000000000; int lg[3001][3001], pref[3001][3001]; int rectangle(int r, int c, int h, int w, int q[3001][3001]) { int l1 = 1, r1 = r*c, dodajemo; while (l1 < r1) { ll m = (l1 + r1)/2; vector<vector<int>>vece(r, vector<int>(c, 0)); bool moze = false; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { if (q[i][j] <= m) { dodajemo = 1; } else { dodajemo = -1; } if (i == 0 and j == 0) { vece[i][j] = dodajemo; } else if (i == 0) { vece[i][j] = vece[i][j - 1] + dodajemo; } else if (j == 0) { vece[i][j] = vece[i - 1][j] + dodajemo; } else { vece[i][j] = vece[i - 1][j] + vece[i][j - 1] - vece[i - 1][j - 1] + dodajemo; } if (i + 1 >= h and j + 1 >= w) { int ima = vece[i][j]; if (i >= h) { ima -= vece[i - h][j]; } if (j >= w) { ima -= vece[i][j - w]; } if (i >= h and j >= w) { ima += vece[i - h][j - w]; } if (ima > 0) { moze = true; } } } } if (moze) { r1 = m; } else { l1 = m + 1; } } return l1; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:8:16: error: 'vector' was not declared in this scope
    8 |         vector<vector<int>>vece(r, vector<int>(c, 0));
      |                ^~~~~~
quality.cpp:8:23: error: expected primary-expression before 'int'
    8 |         vector<vector<int>>vece(r, vector<int>(c, 0));
      |                       ^~~
quality.cpp:19:21: error: 'vece' was not declared in this scope
   19 |                     vece[i][j] = dodajemo;
      |                     ^~~~
quality.cpp:22:21: error: 'vece' was not declared in this scope
   22 |                     vece[i][j] = vece[i][j - 1] + dodajemo;
      |                     ^~~~
quality.cpp:25:21: error: 'vece' was not declared in this scope
   25 |                     vece[i][j] = vece[i - 1][j] + dodajemo;
      |                     ^~~~
quality.cpp:28:21: error: 'vece' was not declared in this scope
   28 |                     vece[i][j] = vece[i - 1][j] + vece[i][j - 1] - vece[i - 1][j - 1] + dodajemo;
      |                     ^~~~
quality.cpp:31:31: error: 'vece' was not declared in this scope
   31 |                     int ima = vece[i][j];
      |                               ^~~~