# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28607 | Shocking Hot (#68) | Oriental P.A.D.A.K (FXCUP2_padak) | C++14 | 716 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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<pair<int,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, B});
}
}
while(!q.empty()) {
int A, B; tie(A, B) = q.front(); q.pop();
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, 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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |