제출 #998202

#제출 시각아이디문제언어결과실행 시간메모리
998202rahidilbayramli삶의 질 (IOI10_quality)C++17
0 / 100
19 ms37712 KiB
#include<bits/stdc++.h> #include "quality.h" #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define f first #define s second #define pb push_back #define p_b pop_back using namespace std; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int l = 1, r = R * C, ans = R * C; int grid[3001][3001]; for(int i = 0; i < 3001; i++) { for(int j = 0; j < 3001; j++) grid[i][j] = 0; } while(l <= r) { int mid = (l + r) / 2, maxx = 0; for(int i = 0; i < R; i++) { for(int j = 0; j < C; j++) { int sum = 0; grid[i][j] = (Q[i][j] <= mid); if(i) grid[i][j] += grid[i-1][j]; if(j) grid[i][j] += grid[i][j-1]; if(i && j) grid[i][j] -= grid[i-1][j-1]; sum = grid[i][j]; if(i - H >= 0) sum -= grid[i-H][j]; if(j - W >= 0) sum -= grid[i][j-W]; if(i - H >= 0 && j - W >= 0) sum += grid[i-H][j-W]; maxx = max(maxx, sum); } } if(maxx > R * C / 2) { ans = min(ans, mid); r = mid - 1; } else l = mid + 1; } return ans; }
#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...