| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 41116 | 14kg | 주유소 (KOI16_gas) | C++11 | 51 ms | 51904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <queue>
#include <vector>
#include <functional>
#define INF 999999999999999999
#define min2(x,y) (x<y?x:y)
using namespace std;
typedef pair<long long, pair<int, int> > pip;
int n, in[2501];
long long d[2501][2501];
vector<pair<int, int> > r[2501];
priority_queue<pip, vector<pip>, greater<pip> > Q;
int main() {
int m, x, y, z;
pip t;
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) scanf("%d", &in[i]);
while (m--) {
scanf("%d %d %d", &x, &y, &z);
r[x].push_back({ y,z }), r[y].push_back({ x,z });
}
for (int i = 1; i <= n; i++)
for (int j = 0; j <= 2500; j++) d[i][j] = INF;
Q.push({ 0,{1,2500} });
while (!Q.empty()) {
t = Q.top(), Q.pop();
if (t.second.first == n) {
printf("%lld", t.first);
return 0;
}
t.second.second = min2(t.second.second, in[t.second.first]);
for(auto i:r[t.second.first])
if (d[i.first][t.second.second] > t.first + t.second.second*i.second) {
d[i.first][t.second.second] = t.first + t.second.second*i.second;
Q.push({ d[i.first][t.second.second],{i.first,t.second.second} });
}
}
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
