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

#TimeUsernameProblemLanguageResultExecution timeMemory
1101082SulAQuality Of Living (IOI10_quality)C++17
40 / 100
5060 ms6004 KiB
#include <bits/stdc++.h> #include "quality.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define bitcount __builtin_popcountll using namespace std; using namespace __gnu_pbds; using namespace chrono; int rectangle(int n, int m, int h, int w, int a[3001][3001]) { auto check = [&](int x) { vector<vector<int>> g(n, vector<int>(m, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { g[i][j] = a[i][j] <= x ? 1 : -1; if (i != 0) g[i][j] += g[i-1][j]; if (j != 0) g[i][j] += g[i][j-1]; if (i != 0 && j != 0) g[i][j] -= g[i-1][j-1]; } } auto sum = [&](int x1, int y1, int x2, int y2) { int sum = g[x2][y2]; if (x1 != 0) sum -= g[x1 - 1][y2]; if (y1 != 0) sum -= g[x2][y1 - 1]; if (x1 != 0 && y1 != 0) sum += g[x1 - 1][y1 - 1]; return sum; }; int mx = -h*w; for (int x1 = 0, x2 = h-1; x2 < n; x1++, x2++) { for (int y1 = 0, y2 = w-1; y2 < m; y1++, y2++) { int s = sum(x1, y1, x2, y2); mx = max(mx, s); } } return mx; }; int ans = 0; int l = 1, r = n*m; for (int i = l; i <= r; i++) if (check(i) > 0) return i; assert(false); }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:38:9: warning: unused variable 'ans' [-Wunused-variable]
   38 |     int ans = 0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...