# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28614 | 2017-07-16T07:59:54 Z | Shocking Hot(#1200, khsoo01) | Oriental P.A.D.A.K (FXCUP2_padak) | C++14 | 833 ms | 65536 KB |
#include<bits/stdc++.h> using namespace std; const int inf = 1e9; int n, m, k, b, z, x, y; vector<int> d[1000005], arr; 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=1;i<=n;i++) { d[i].push_back(0); for(int j=1;j<=m;j++) d[i].push_back(inf); } for(int i=1;i<=k;i++) { int A, B; scanf("%d%d",&A,&B); if(d[A][B] == inf) { d[A][B] = 0; q.push(A*(m+1)+B); } } while(!q.empty()) { int A, B, T; T = q.front(); q.pop(); A = T / (m+1); B = T % (m+1); arr.push_back(d[A][B]); for(int i=0;i<4;i++) { int na = A+dx[i], nb = B+dy[i]; if(1 <= na && na <= n && 1 <= nb && nb <= m && d[na][nb] == inf) { d[na][nb] = d[A][B] + 1; q.push(na*(m+1)+nb); } } } for(auto &T : arr) { if(y/z < T) y++; } reverse(arr.begin(), arr.end()); for(auto &T : arr) { if(x/z < T) x++; } printf("%d %d\n",x,y); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 25460 KB | Output is correct |
2 | Correct | 9 ms | 25460 KB | Output is correct |
3 | Correct | 66 ms | 35704 KB | Output is correct |
4 | Correct | 73 ms | 37612 KB | Output is correct |
5 | Correct | 59 ms | 35708 KB | Output is correct |
6 | Correct | 83 ms | 39500 KB | Output is correct |
7 | Correct | 53 ms | 36572 KB | Output is correct |
8 | Correct | 49 ms | 37832 KB | Output is correct |
9 | Correct | 163 ms | 62940 KB | Output is correct |
10 | Correct | 66 ms | 35712 KB | Output is correct |
11 | Correct | 66 ms | 37628 KB | Output is correct |
12 | Correct | 69 ms | 35708 KB | Output is correct |
13 | Correct | 83 ms | 39508 KB | Output is correct |
14 | Correct | 56 ms | 36572 KB | Output is correct |
15 | Correct | 46 ms | 37836 KB | Output is correct |
16 | Correct | 216 ms | 62940 KB | Output is correct |
17 | Correct | 136 ms | 35780 KB | Output is correct |
18 | Correct | 116 ms | 37860 KB | Output is correct |
19 | Correct | 73 ms | 35752 KB | Output is correct |
20 | Correct | 93 ms | 39532 KB | Output is correct |
21 | Correct | 106 ms | 36988 KB | Output is correct |
22 | Correct | 56 ms | 37840 KB | Output is correct |
23 | Correct | 306 ms | 62968 KB | Output is correct |
24 | Correct | 476 ms | 39900 KB | Output is correct |
25 | Correct | 456 ms | 41800 KB | Output is correct |
26 | Correct | 449 ms | 39888 KB | Output is correct |
27 | Correct | 703 ms | 43696 KB | Output is correct |
28 | Correct | 443 ms | 40768 KB | Output is correct |
29 | Correct | 429 ms | 41940 KB | Output is correct |
30 | Memory limit exceeded | 833 ms | 65536 KB | Memory limit exceeded |
31 | Halted | 0 ms | 0 KB | - |