# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49669 | gs14004 | Travelling Merchant (APIO17_merchant) | C++17 | 805 ms | 1788 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 lint;
typedef long double llf;
typedef pair<lint, lint> pi;
int n, m, k;
int b[105][1005], s[105][1005];
int adj[105][105], dx[105][105];
llf gph[105][105];
bool trial(llf t){
// TotalProfit - t * TotalTime > 0
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(adj[i][j] > 1e9 + 10) gph[i][j] = -1e12;
else gph[i][j] = dx[i][j] - t * adj[i][j];
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
for(int k=1; k<=n; k++){
gph[j][k] = max(gph[j][k], gph[j][i] + gph[i][k]);
}
}
}
for(int i=1; i<=n; i++){
if(gph[i][i] >= 0) return 1;
}
return 0;
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... |