Submission #761089

#TimeUsernameProblemLanguageResultExecution timeMemory
761089BlagojQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() int r, c, h, w, a[3002][3002], dp[3002][3002]; const int s = 801; bool b(int v) { int s = (h * w) / 2 + 1; for (int i = 0; i < r; i++) { int cnt = 0; for (int j = 0; j < c; j++) { if (a[i][j] <= v) cnt++; dp[i][j] = cnt; if (i - 1 >= 0) { dp[i][j] += dp[i - 1][j]; } if (i == h - 1 && j == w - 1) { if (dp[i][j] >= s) return 1; } else if (i == h - 1 && j >= w) { if (dp[i][j] - dp[i][j - w] >= s) return 1; } else if (i >= h && j == w - 1) { if (dp[i][j] - dp[i - h][j] >= s) return 1; } else if (i >= h - 1 && j >= w - 1) { if (dp[i][j] - dp[i - h][j] - dp[i][j - w] + dp[i - h][j - w] >= s) return 1; } } } return 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> r >> c >> h >> w; vector<int> v; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { cin >> a[i][j]; v.push_back(a[i][j]); } } int l = 0, rr = r * c; sort(all(v)); int ans = INT_MAX; while (l + 1 < rr) { int m = (l + rr) / 2; if (b(v[m])) { ans = min(ans, v[m]); rr = m; } else { l = m; } } if (b(v[0])) ans = v[0]; cout << ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccAiyJtS.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccfaPCkO.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccAiyJtS.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status