# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103983 | autumn_eel | Travelling Merchant (APIO17_merchant) | C++14 | 47 ms | 3320 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>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int d[200][200];
int b[200][2000],s[200][2000];
int main(){
int n,m,K;cin>>n>>m>>K;
rep(i,n)rep(j,K)scanf("%d%d",&b[i][j],&s[i][j]);
memset(d,0x3f,sizeof(d));
rep(i,n)d[i][i]=0;
rep(i,m){
int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
d[a][b]=c;
}
rep(k,n)rep(i,n)rep(j,n){
d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
}
int Max=0;
for(int i=1;i<n;i++){
rep(j,K){
if(b[0][j]==-1||s[i][j]==-1)continue;
Max=max(Max,(s[i][j]-b[0][j])/(d[0][i]+d[i][0]));
}
}
cout<<Max<<endl;
}
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... |