# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50747 | ayhcbagnop | Travelling Merchant (APIO17_merchant) | C++14 | 126 ms | 1676 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.
//Power Of Ninja Go
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii;
#define X first
#define Y second
#define pb push_back
const int maxn = 105;
const int maxk = 1005;
int dist[maxn][maxn];
int buy[maxn][maxk];
int sell[maxn][maxk];
ll prof[maxn][maxn];
ll aug[maxn][maxn];
int n, m, k;
bool works(ll x)
{
//printf("x = %lld\n", x);
for(int i = 1; i<= n; i++)
{
for(int j = 1; j<= n; j++)
{
aug[i][j] = 1LL*x*dist[i][j] - prof[i][j];
//printf("aug[%d][%d] = %lld\n", i, j, aug[i][j]);
}
}
for(int k = 1; k<= n; k++) for(int i = 1; i<= n; i++) for(int j = 1; j<= n; j++)
aug[i][j] = min(aug[i][j], aug[i][k]+aug[k][j]);
for(int i = 1; i<= n; i++) if(aug[i][i]<= 0) return true;
Compilation message (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... |