# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1147675 | Nelt | Travelling Merchant (APIO17_merchant) | C++20 | 84 ms | 2376 KiB |
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 105, K = 1005;
__int128 dist[N][N], best[N][N], d[N][N];
ll s[N][K], b[N][K];
void solve()
{
ll n, m, k;
cin >> n >> m >> k;
for (ll i = 1; i <= n; i++)
for (ll j = 1; j <= k; j++)
cin >> b[i][j] >> s[i][j];
for (ll i = 1; i <= n; i++)
for (ll j = 1; j <= n; j++)
dist[i][j] = 1e18;
for (ll i = 1; i <= n; i++)
for (ll j = 1; j <= n; j++)
for (ll x = 1; x <= k; x++)
if (b[i][x] != -1 and s[j][x] != -1)
best[i][j] = max(best[i][j], (__int128)s[j][x] - b[i][x]);
while (m--)
{
ll a, b, c;
cin >> a >> b >> c;
dist[a][b] = c;
}
# | 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... |