이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#pragma once
#include "wombats.h"
#include <bits/stdc++.h>
#define f first
#define s second
const int INF = 1e9 + 7;
using namespace std;
const int B = 200000 + 10;
int n,m;
vector <pair <int,int> > reb[B];
void init(int R, int C,int H[5000][200], int V[5000][200]) {
n = R,m = C;
for(int i = 0;i < n;i++) {
for(int j = 0;j < m - 1;j++) {
reb[i*m + j].push_back({i*m + j + 1,H[i][j]});
reb[i*m + j + 1].push_back({i*m + j,H[i][j]});
}
}
for(int i = 0;i < n - 1;i++) {
for(int j = 0;j < m;j++) {
reb[i*m + j].push_back({(i + 1)*m + j,V[i][j]});
}
}
};
void changeH(int P, int Q, int W) {
};
void changeV(int P, int Q, int W) {
};
int dijkstra(int x,int y) {
int rast[n*m] = {};
for(int i = 0;i < n*m;i++) {
rast[i] = INF;
}
rast[x] = 0;
set <pair <int,int> > s;
s.insert({0,x});
while(!s.empty()) {
pair <int,int> v = *s.begin();
s.erase(s.find(v));
for(auto u:reb[v.s]) {
int rst = u.s + v.f;
if(rst < rast[u.f]) {
s.erase({rast[u.f],u.f});
rast[u.f] = rst;
s.insert({rast[u.f],u.f});
}
}
}
return rast[m*(n - 1) + y];
}
int escape(int V1, int V2) {
int x = V1,y = V2;
return dijkstra(x,y);
};
/*
signed main() {
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i = 0;i < n;i++) {
for(int j = 0;j < m - 1;j++) {
cin >> H[i][j];
}
}
for(int i = 0;i < n - 1;i++) {
for(int j = 0;j < m;j++) {
cin >> V[i][j];
}
}
init(n,m);
int q;
cin >> q;
while(q--) {
int type;
cin >> type;
if(type == 3) {
int x,y;
cin >> x >> y;
cout << escape(x,y) << endl;
}
else {
int a,b,c;
cin >> a >> b >> c;
}
}
}
*/
컴파일 시 표준 에러 (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... |