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

#TimeUsernameProblemLanguageResultExecution timeMemory
1085035SunbaeQuality Of Living (IOI10_quality)C++17
100 / 100
1646 ms140308 KiB
#include <bits/stdc++.h> #define z exit(0) using namespace std; const int N = 3005; int qs[N][N], a[N][N]; bool V(int i, int j, int m, int n){ return i>=0 && j>=0 && i<m && j<n;} int f(int i, int j, int m, int n){ return V(i, j, m, n) ? qs[i][j] : 0;} int rectangle(int m, int n, int kx, int ky, int a[3001][3001]){ int low = 0, high = 1e9, t, p = kx * ky; while(low <= high){ int mid = low + ((high-low)>>1); for(int i = 0; i<m; ++i) for(int j = 0; j<n; ++j) qs[i][j] = f(i-1, j, m, n) + f(i, j-1, m, n) + (a[i][j] <= mid) - f(i-1, j-1, m, n); bool ch = false; for(int i = kx-1; i<m; ++i){ for(int j = ky-1; j<n; ++j) if(qs[i][j] - f(i-kx, j, m, n) - f(i, j-ky, m, n) + f(i-kx, j-ky, m, n) > (p-1)/2){ch = true; break;} if(ch) break; } if(ch) high = mid-1, t = mid; else low = mid+1; } return t; } /* signed main(){ int m, n, kx, ky; scanf("%d %d %d %d", &m, &n, &kx, &ky); for(int i = 0; i<m; ++i){ for(int j = 0; j<n; ++j) scanf("%d", &a[i][j]); } printf("%d", rectangle(m, n, kx, ky, a)); } */

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:21:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |  return t;
      |         ^
#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...