# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117179 | gustavo_d | Travelling Merchant (APIO17_merchant) | C++17 | 668 ms | 17976 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100;
const int MAXK = 1000;
const double EPS = 0.0001;
pair<ll, ll> path[MAXN][MAXN][MAXN+1];
ll buy[MAXN][MAXK], sell[MAXN][MAXK];
ll dist[MAXN][MAXN];
vector<pair<int, ll>> adj[MAXN];
double val(pair<ll, ll> p) {
// cout << "divisão" << p.first << ' ' << p.second << endl;
return (double)p.first / (double)p.second;
}
void Dijkstra(int src) {
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
pq.push({0, src});
dist[src][src] = 0;
while (!pq.empty()) {
int v = pq.top().second; ll d = pq.top().first;
pq.pop();
if (dist[src][v] < d) continue;
for (auto [viz, w] : adj[v]) {
if (d + w >= dist[src][viz]) continue;
dist[src][viz] = d + w;
pq.push({dist[src][viz], viz});
}
}
# | 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... |