# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
335360 | ChrisT | Soccer (JOI17_soccer) | C++17 | 989 ms | 38340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct State {
long long d; int x,y,z;
bool operator< (const State &o) const {
return d > o.d;
}
};
const int MN = 505;
long long dist[MN][MN][5];
int pre[MN][MN], dx[4] = {0,0,1,-1}, dy[4] = {1,-1,0,0};
int main() {
int n,m,a,b,c,k;
scanf ("%d %d %d %d %d %d",&n,&m,&a,&b,&c,&k);
queue<pair<int,int>> q; vector<pair<int,int>> bois(k);
memset(pre,0x3f,sizeof pre);
for (auto &[x,y] : bois) {
scanf ("%d %d",&x,&y);
pre[x][y] = 0; q.push({x,y});
}
while (!q.empty()) {
auto [x,y] = q.front(); q.pop();
for (int k = 0; k < 4; k++) {
int nx = x + dx[k], ny = y + dy[k];
if (nx >= 1 && nx <= n && 1 <= ny && ny <= m && pre[x][y] + 1 < pre[nx][ny]) {
pre[nx][ny] = pre[x][y] + 1;
q.push({nx,ny});
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |