Submission #28436

#TimeUsernameProblemLanguageResultExecution timeMemory
28436Sorry AcornCkiGuiziTeam (#68)Oriental P.A.D.A.K (FXCUP2_padak)C++14
Compilation error
0 ms0 KiB
#include <cstdio> #include <queue> 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)

padak.cpp: In function 'int main()':
padak.cpp:31:19: error: 'sort' was not declared in this scope
  sort(d, d + n * m);
                   ^
padak.cpp:18: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:20:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &i, &j);
                        ^