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

#TimeUsernameProblemLanguageResultExecution timeMemory
331630Aldas25Quality Of Living (IOI10_quality)C++14
100 / 100
2650 ms111876 KiB
#include "quality.h" //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") #include <bits/stdc++.h> //#include <ctime> using namespace std; #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define REP(n) FOR(O, 1, (n)) #define pb push_back #define f first #define s second typedef long double ld; typedef long long ll; typedef pair<int, int> pii; typedef pair<int, pii> piii; typedef vector<int> vi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<piii> viii; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MAXN = 500100, MAXK = 20; const ll MOD = 1e9+7; const ll INF = 1e18; const ld PI = asin(1) * 2; int r, c, h, w; int grid[3100][3100]; int pref[3100][3100]; int sum (int x2, int y2) { int x1 = x2-h+1, y11 = y2-w+1; return (pref[x2][y2] - pref[x2][y11-1] - pref[x1-1][y2] + pref[x1-1][y11-1]); } bool check (int x) { FOR(i, 1, r) { int tmp = 0; FOR(j, 1, c) { if (grid[i][j] <= x) tmp++; pref[i][j] = pref[i-1][j] + tmp; } } int mn = (h*w+1)/2; FOR(i, h, r) FOR(j, w, c) { if (sum(i,j) >= mn) return true; } return false; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { r = R, c = C, h = H, w = W; FOR(i, 1, r) FOR(j, 1, c) grid[i][j] = Q[i-1][j-1]; int le = 1, ri = r*c; while (le < ri) { int mid = (le+ri)/2; if (check (mid)) ri = mid; else le = mid+1; } return le; }
#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...