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

#TimeUsernameProblemLanguageResultExecution timeMemory
367387ijxjdjdQuality Of Living (IOI10_quality)C++14
100 / 100
3967 ms141388 KiB
using namespace std; #include <bits/stdc++.h> #include "quality.h" #pragma GCC optimize ("Ofast") #pragma GCC target("avx2") #define FR(i, N) for (int i = 0; i < int(N); i++) #define all(x) begin(x), end(x) int pref[3001][3001]; pair<int, int> coords[3001*3001]; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int low = 0; int high = R*C-1; FR(i, R){ FR(j, C){ coords[Q[i][j]-1] = {i, j}; } } int base = H*W/2; while (low < high) { int mid = (low + high)/2; memset(pref, 0, sizeof(pref)); FR(i, mid+1) { pref[coords[i].first][coords[i].second]++; } FR(i, R) { FR(j, C) { pref[i][j] += (i > 0 ? pref[i-1][j] : 0) + (j > 0 ? pref[i][j-1] : 0) - (i > 0 && j > 0 ? pref[i-1][j-1] : 0); if (pref[i][j] - (i >= H ? pref[i-H][j] : 0) - (j >= W ? pref[i][j-W] : 0) + (j >= W && i >= H ? pref[i-H][j-W] : 0) > base) { high = mid; } } } if (high != mid) { low = mid+1; } } return high+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...