# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28634 | 2017-07-16T08:14:38 Z | Shocking Hot(#1200, khsoo01) | Oriental P.A.D.A.K (FXCUP2_padak) | C++14 | 439 ms | 14088 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 | 0 ms | 9832 KB | Output is correct |
2 | Correct | 0 ms | 9832 KB | Output is correct |
3 | Correct | 33 ms | 9832 KB | Output is correct |
4 | Correct | 36 ms | 9832 KB | Output is correct |
5 | Correct | 36 ms | 9832 KB | Output is correct |
6 | Correct | 33 ms | 9832 KB | Output is correct |
7 | Correct | 39 ms | 9832 KB | Output is correct |
8 | Correct | 26 ms | 9832 KB | Output is correct |
9 | Correct | 26 ms | 9832 KB | Output is correct |
10 | Correct | 39 ms | 9832 KB | Output is correct |
11 | Correct | 43 ms | 9964 KB | Output is correct |
12 | Correct | 36 ms | 9832 KB | Output is correct |
13 | Correct | 33 ms | 9832 KB | Output is correct |
14 | Correct | 39 ms | 9832 KB | Output is correct |
15 | Correct | 36 ms | 9832 KB | Output is correct |
16 | Correct | 36 ms | 9832 KB | Output is correct |
17 | Correct | 49 ms | 9964 KB | Output is correct |
18 | Correct | 76 ms | 10236 KB | Output is correct |
19 | Correct | 49 ms | 9964 KB | Output is correct |
20 | Correct | 33 ms | 9964 KB | Output is correct |
21 | Correct | 79 ms | 10360 KB | Output is correct |
22 | Correct | 43 ms | 9832 KB | Output is correct |
23 | Correct | 39 ms | 9832 KB | Output is correct |
24 | Correct | 376 ms | 14088 KB | Output is correct |
25 | Correct | 439 ms | 14088 KB | Output is correct |
26 | Correct | 406 ms | 14088 KB | Output is correct |
27 | Correct | 386 ms | 14088 KB | Output is correct |
28 | Correct | 386 ms | 14088 KB | Output is correct |
29 | Correct | 419 ms | 13956 KB | Output is correct |
30 | Correct | 396 ms | 14088 KB | Output is correct |
31 | Correct | 29 ms | 9832 KB | Output is correct |
32 | Correct | 26 ms | 9832 KB | Output is correct |