이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=5e3+5, cx=2e2+5;
int r, c, ver[nx][cx], horr[nx][cx], horl[nx][cx], dp[nx][cx];
void init(int R, int C, int H[5000][200], int V[5000][200]) {
r=R, c=C;
for (int i=0; i<R-1; i++) for (int j=0; j<C; j++) ver[i][j]=V[i][j];
for (int i=0; i<R; i++) for (int j=0; j<C-1; j++) horr[i][j]=H[i][j], horl[i][j+1]=H[i][j];
}
void changeH(int P, int Q, int W) {
horr[P][Q]=W;
horl[P][Q+1]=W;
}
void changeV(int P, int Q, int W) {
ver[P][Q]=W;
}
int escape(int V1, int V2) {
for (int i=0; i<r; i++) for (int j=0; j<c; j++) dp[i][j]=1e9;
priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>> pq;
pq.push({0, 0, V1});
dp[0][V1]=0;
while (!pq.empty())
{
auto [w, cr, cc]=pq.top();
pq.pop();
if (cr!=r-1&&dp[cr+1][cc]>w+ver[cr][cc]) dp[cr+1][cc]=w+ver[cr][cc], pq.push({dp[cr+1][cc], cr+1, cc});
if (cc!=c-1&&dp[cr][cc+1]>w+horr[cr][cc]) dp[cr][cc+1]=w+horr[cr][cc], pq.push({dp[cr][cc+1], cr, cc+1});
if (cc!=0&&dp[cr][cc-1]>w+horl[cr][cc]) dp[cr][cc-1]=w+horl[cr][cc], pq.push({dp[cr][cc-1], cr, cc-1});
}
return dp[r-1][V2];
}
컴파일 시 표준 에러 (stderr) 메시지
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |