# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527892 | AdamGS | Soccer (JOI17_soccer) | C++17 | 767 ms | 39192 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;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
const int LIM=507, MAXN=1e5+7;
const ll INF=1e18+7;
int dx[]={1, 0, -1, 0}, dy[]={0, 1, 0, -1};
ll wart[LIM][LIM], odl[LIM][LIM][5], h, w, a, b, c, n;
pair<int,int>T[MAXN];
bool ok(int a, int b) {
return 0<=a && a<h && 0<=b && b<w;
}
void BFS() {
rep(i, h) rep(j, w) wart[i][j]=INF;
queue<pair<int,int>>q;
rep(i, n) {
wart[T[i].st][T[i].nd]=0;
q.push({T[i].st, T[i].nd});
}
while(!q.empty()) {
int x=q.front().st, y=q.front().nd; q.pop();
rep(i, 4) if(ok(x+dx[i], y+dy[i]) && wart[x+dx[i]][y+dy[i]]==INF) {
wart[x+dx[i]][y+dy[i]]=wart[x][y]+c;
q.push({x+dx[i], y+dy[i]});
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |