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

제출 #208958

#제출 시각아이디문제언어결과실행 시간메모리
2089582Nor22삶의 질 (IOI10_quality)C++14
100 / 100
2952 ms176984 KiB
#include <unordered_set> #include <unordered_map> #include <algorithm> #include <iostream> #include <fstream> #include <string> #include <cstring> #include <cstdint> #include <cstdlib> #include <cstdio> #include <cctype> #include <cmath> #include <vector> #include <bitset> #include <queue> #include <deque> #include <stack> #include <cmath> #include <tuple> #include <list> #include <set> #include <map> #define add push_back #define m_p make_pair #define fr first #define sc second #define endl '\n' using namespace std; typedef long long ll; typedef unsigned long long llu; typedef long double ld; typedef pair<ll, ll> pii; const ll N = 1000005, mod = 998244353, M = 3001; ll n, m, k, i, j, ans, kaskad[N], matrix[M][M], pref[M][M], h, w; bool check(ll value) { for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { ll x = -1; if (matrix[i][j] > value) x = 1; else if (matrix[i][j] == value) x = 0; pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + x; } } for (int i = h; i <= n; ++i) { for (int j = w; j <= m; ++j) { if (pref[i][j] - pref[i - h][j] - pref[i][j - w] + pref[i - h][j - w] <= 0) return true; } } return false; } void BinarySearch(ll left, ll right) { if (right - left <= 1) return; ll mid = (left + right) / 2; if (!check(mid)) { BinarySearch(mid, right); } else { ans = mid; BinarySearch(left, mid); } } int rectangle(int nn, int mm, int hh, int ww, int a[M][M]) { n = nn; m = mm; h = hh; w = ww; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { matrix[i + 1][j + 1] = a[i][j]; } } BinarySearch(0, n * m); 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...