Submission #28438

# Submission time Handle Problem Language Result Execution time Memory
28438 2017-07-16T05:52:18 Z Sorry AcornCkiGuiziTeam(#1226, gs13068) Oriental P.A.D.A.K (FXCUP2_padak) C++14
1 / 1
489 ms 10096 KB
#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

padak.cpp: In function 'int main()':
padak.cpp:19:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%*d%d", &n, &m, &l, &k);
                                      ^
padak.cpp:21:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &i, &j);
                        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5840 KB Output is correct
2 Correct 0 ms 5840 KB Output is correct
3 Correct 63 ms 5840 KB Output is correct
4 Correct 69 ms 5840 KB Output is correct
5 Correct 69 ms 5840 KB Output is correct
6 Correct 96 ms 5840 KB Output is correct
7 Correct 73 ms 5840 KB Output is correct
8 Correct 59 ms 5840 KB Output is correct
9 Correct 106 ms 5840 KB Output is correct
10 Correct 63 ms 5840 KB Output is correct
11 Correct 66 ms 5972 KB Output is correct
12 Correct 83 ms 5840 KB Output is correct
13 Correct 69 ms 5840 KB Output is correct
14 Correct 73 ms 5840 KB Output is correct
15 Correct 76 ms 5840 KB Output is correct
16 Correct 73 ms 5840 KB Output is correct
17 Correct 66 ms 5972 KB Output is correct
18 Correct 76 ms 6244 KB Output is correct
19 Correct 69 ms 5972 KB Output is correct
20 Correct 69 ms 5972 KB Output is correct
21 Correct 83 ms 6368 KB Output is correct
22 Correct 76 ms 5840 KB Output is correct
23 Correct 69 ms 5840 KB Output is correct
24 Correct 449 ms 10096 KB Output is correct
25 Correct 446 ms 10096 KB Output is correct
26 Correct 433 ms 10096 KB Output is correct
27 Correct 489 ms 10096 KB Output is correct
28 Correct 453 ms 10096 KB Output is correct
29 Correct 423 ms 9964 KB Output is correct
30 Correct 433 ms 10096 KB Output is correct
31 Correct 66 ms 5840 KB Output is correct
32 Correct 33 ms 5840 KB Output is correct