# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1162967 | thinknoexit | Travelling Merchant (APIO17_merchant) | C++20 | 218 ms | 2192 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 103;
const int K = 1010;
ll b[N][K], s[N][K];
ll dist[N][N], dis[N][N];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m, k;
cin >> n >> m >> k;
for (int i = 1;i <= n;i++) {
for (int j = 1;j <= k;j++) cin >> b[i][j] >> s[i][j];
}
for (int i = 1;i <= n;i++) {
for (int j = 1;j <= n;j++) {
dist[i][j] = 1e9 + 1;
}
}
for (int i = 1;i <= m;i++) {
int u, v;
ll t;
cin >> u >> v >> t;
dist[u][v] = min(dist[u][v], t);
}
for (int k = 1;k <= n;k++) {
for (int i = 1;i <= n;i++) {
for (int j = 1;j <= n;j++) {
if (dist[i][j] > dist[i][k] + dist[k][j]) {
dist[i][j] = dist[i][k] + dist[k][j];
# | 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... |