# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52095 | Angelos | Travelling Merchant (APIO17_merchant) | C++17 | 404 ms | 1852 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 <iostream>
#include <cstring>
#define MAXN 103
#define MAXK 1003
const long long INF = 1e10;
using namespace std;
typedef long long ll;
int N , M , K , T[MAXN][MAXN] , B[MAXN][MAXK] , S[MAXN][MAXK];
long long profit[MAXN][MAXN] , adj[MAXN][MAXN] , adj2[MAXN][MAXN] , dist[MAXN][MAXN];
bool check(ll x){
for(int i=1; i<=N; i++){
for(int j=1; j<=N; j++){
if(i == j || dist[i][j] == INF){adj[i][j] = -INF; continue;}
adj[i][j] = (ll)profit[i][j] - (ll)dist[i][j]*x;
adj[i][j] = max(-INF, adj[i][j]);
}
}
for(int k=1; k<=N; k++)
for(int i=1; i<=N; i++)
for(int j=1; j<=N; j++){
adj[i][j] = max(adj[i][j] , adj[i][k] + adj[k][j]);
if(adj[i][i] >= 0) return true;
adj[i][j] = min(INF , adj[i][j]);
adj2[i][j] = adj[i][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... |