# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74347 | 2018-08-31T10:56:32 Z | khsoo01 | Oriental P.A.D.A.K (FXCUP2_padak) | C++11 | 367 ms | 65828 KB |
#include<bits/stdc++.h> using namespace std; const int inf = 1e9; int n, m, k, b, z, x, y, a[1000005], d[1000005]; queue<int> q; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { scanf("%d%d%d%d%d",&n,&m,&k,&b,&z); for(int i=0;i<n*m;i++) d[i] = inf; for(int i=1;i<=k;i++) { int A, B; scanf("%d%d",&A,&B); A--; B--; if(d[A*m+B] == inf) { d[A*m+B] = 0; q.push(A*m+B); } } while(!q.empty()) { int T = q.front(); q.pop(); int A = T/m, B = T%m; if(y/z < d[T]) y++; a[d[T]]++; for(int i=0;i<4;i++) { int na = A+dx[i], nb = B+dy[i]; if(0 <= na && na < n && 0 <= nb && nb < m && d[na*m+nb] == inf) { d[na*m+nb] = d[T] + 1; q.push(na*m+nb); } } } for(int i=n*m;i>=0;i--) { for(int j=0;j<a[i];j++) { if(x/z < i) x++; } } printf("%d %d\n",x,y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 34 ms | 4288 KB | Output is correct |
4 | Correct | 33 ms | 4436 KB | Output is correct |
5 | Correct | 38 ms | 4584 KB | Output is correct |
6 | Correct | 33 ms | 4648 KB | Output is correct |
7 | Correct | 37 ms | 4648 KB | Output is correct |
8 | Correct | 32 ms | 7864 KB | Output is correct |
9 | Correct | 32 ms | 7864 KB | Output is correct |
10 | Correct | 38 ms | 7864 KB | Output is correct |
11 | Correct | 37 ms | 7864 KB | Output is correct |
12 | Correct | 37 ms | 7864 KB | Output is correct |
13 | Correct | 38 ms | 7864 KB | Output is correct |
14 | Correct | 33 ms | 7864 KB | Output is correct |
15 | Correct | 34 ms | 7864 KB | Output is correct |
16 | Correct | 36 ms | 7864 KB | Output is correct |
17 | Correct | 39 ms | 7864 KB | Output is correct |
18 | Correct | 43 ms | 7864 KB | Output is correct |
19 | Correct | 64 ms | 7864 KB | Output is correct |
20 | Correct | 38 ms | 7864 KB | Output is correct |
21 | Correct | 46 ms | 7864 KB | Output is correct |
22 | Correct | 36 ms | 7864 KB | Output is correct |
23 | Correct | 41 ms | 7864 KB | Output is correct |
24 | Correct | 268 ms | 16560 KB | Output is correct |
25 | Correct | 279 ms | 24436 KB | Output is correct |
26 | Correct | 367 ms | 32712 KB | Output is correct |
27 | Correct | 337 ms | 40432 KB | Output is correct |
28 | Correct | 333 ms | 48576 KB | Output is correct |
29 | Correct | 263 ms | 57032 KB | Output is correct |
30 | Runtime error | 270 ms | 65828 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
31 | Halted | 0 ms | 0 KB | - |