(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.

제출 #236524

#제출 시각아이디문제언어결과실행 시간메모리
236524nicolaalexandra삶의 질 (IOI10_quality)C++14
100 / 100
3981 ms125076 KiB
#include <bits/stdc++.h> #include "quality.h" #define DIM 3001 using namespace std; int sp[DIM][DIM],v[DIM*DIM]; int verif (int n, int m, int h, int w, int a[3001][3001], int val){ int i,j; for (i=1;i<=n;i++) for (j=1;j<=m;j++) sp[i][j] = 0; for (i=1;i<=n;i++) for (j=1;j<=m;j++){ sp[i][j] = sp[i-1][j] + sp[i][j-1] - sp[i-1][j-1]; if (a[i-1][j-1] <= val) sp[i][j]++; } for (i=1;i<=n-h+1;i++) for (j=1;j<=m-w+1;j++){ int sum = sp[i+h-1][j+w-1] - sp[i+h-1][j-1] - sp[i-1][j+w-1] + sp[i-1][j-1]; if (sum >= h*w / 2 + 1) return 1; } return 0; } int rectangle (int n, int m, int h, int w, int a[3001][3001]){ int k = 0; for (int i=0;i<n;i++) for (int j=0;j<m;j++) v[++k] = a[i][j]; sort (v+1,v+k+1); int st = 1, dr = n*m, sol = 0; while (st <= dr){ int mid = (st+dr)>>1; if (verif(n,m,h,w,a,v[mid])){ sol = v[mid]; dr = mid-1; } else st = mid+1; } return sol; }
#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...