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

#TimeUsernameProblemLanguageResultExecution timeMemory
224427jhnah917Quality Of Living (IOI10_quality)C++14
100 / 100
3402 ms107128 KiB
#include "quality.h" #include <bits/stdc++.h> using namespace std; int n, m, h, w; int a[3030][3030]; int v[3030][3030]; //x 초과 : 1, x 미만 : -1 void make(int x){ for(int i=1; i<=n; i++) for(int j=1; j<=m; j++){ if(a[i][j] > x) v[i][j] = 1; else if(a[i][j] < x) v[i][j] = -1; else v[i][j] = 0; } for(int i=1; i<=n; i++) for(int j=1; j<=m; j++){ v[i][j] += v[i-1][j]; v[i][j] += v[i][j-1]; v[i][j] -= v[i-1][j-1]; } } int query(int x, int xx, int y, int yy){ return v[xx][yy] - v[x-1][yy] - v[xx][y-1] + v[x-1][y-1]; } int chk(int x){ make(x); for(int i=1; i<=n; i++) if(i+h-1 <= n){ for(int j=1; j<=m; j++) if(j+w-1 <= m){ if(query(i, i+h-1, j, j+w-1) <= 0) return 1; } } return 0; } int rectangle(int N, int M, int H, int W, int A[3001][3001]) { n = N, m = M, h = H, w = W; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) a[i][j] = A[i-1][j-1]; int l = 0, r = 3030*3030; while(l < r){ int m = l + r >> 1; if(chk(m)) r = m; else l = m + 1; } return r; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:41:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int m = l + r >> 1;
                 ~~^~~
#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...