Submission #1174979

#TimeUsernameProblemLanguageResultExecution timeMemory
1174979vahagng삶의 질 (IOI10_quality)C++20
0 / 100
1 ms576 KiB
#include "quality.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define all(v) v.begin(),v.end() ll pref[110][110]; int rectangle(int n, int m, int h, int w, int a[3001][3001]) { auto check = [&](ll x){ for(int i = 0; i <= n; i++){ for(int j = 0; j <= m; j++){ pref[i][j] = 0; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ pref[i][j] = pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1] + (a[i][j] <= x ? 1 : -1); } } auto qry = [&](int x1, int y1, int x2, int y2){ return pref[x2][y2] - pref[x1-1][y2] - pref[x2][y1-1] + pref[x1-1][y1-1]; }; ll mx = -h*w; for(int x1 = 1, x2 = h; x2 <= n; x1++, x2++){ for(int y1 = 1, y2 = w; y2 <= m; y1++, y2++){ mx = max(mx, qry(x1,y1,x2,y2)); } } return mx; }; for(int i = 1; i <= n*m; i++){ if(check(i) > 0) return i; } }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
#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...