# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
547653 | status_coding | Travelling Merchant (APIO17_merchant) | C++14 | 0 ms | 0 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>
using namespace std;
void calcDist()
{
for(int k=1;k<=n;k++)
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
}
void calcProfit()
{
}
int main()
{
cin>>n>>m>>k;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=k; j++)
cin>>buy[i][j]>>sell[i][j];
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
{
if(i == j)
continue;
dist[i][j] = 1e18;
}
for(int i=1;i<=m;i++)
{
long long x, y, val;
cin>>x>>y>>val;
dist[x][y] = min(dist[x][y], val);
}
calcDist();
calcProfit();
st=0;
dr=1e18;
while(st <= dr)
{
mij = (st+dr)/2;
if(ok(mij))
{
last=mij;
st=mij+1;
}
else
dr=mij-1;
}
cout<<last;
return 0;
}