# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28438 | Sorry AcornCkiGuiziTeam (#68) | Oriental P.A.D.A.K (FXCUP2_padak) | C++14 | 489 ms | 10096 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
queue<int> q;
int d[1000000];
int n, m;
void push(int x, int y) {
if (d[x]) return;
d[x] = y;
q.push(x);
}
int main() {
int i, j, k, l;
scanf("%d%d%d%*d%d", &n, &m, &l, &k);
while (l--) {
scanf("%d%d", &i, &j);
push(i * m + j - m - 1, 1);
}
while (!q.empty()) {
i = q.front();
q.pop();
if (i % m) push(i - 1, d[i] + 1);
if (i % m + 1 < m) push(i + 1, d[i] + 1);
if (i / m) push(i - m, d[i] + 1);
if (i / m + 1 < n) push(i + m, d[i] + 1);
}
sort(d, d + n * m);
j = 0;
for (i = n * m - 1; i >= 0; i--) if (j / k + 1 < d[i]) j++;
printf("%d ", j);
j = 0;
for (i = 0; i < n * m; i++) if (j / k + 1 < d[i]) j++;
printf("%d\n", j);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |