# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50084 | 2018-06-07T13:40:11 Z | mohammad_kilani | Travelling Merchant (APIO17_merchant) | C++17 | 33 ms | 612 KB |
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define oo 1000000000 const int N = 150; int dist[N][N] ; int b[N][N] , s[N][N]; int n , m , k , u , v , w; int main() { scanf("%d%d%d",&n,&m,&k); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i != j) dist[i][j] = oo; } } for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ scanf("%d%d",&b[i][j],&s[i][j]); } } for(int i=0;i<m;i++){ scanf("%d%d%d",&u,&v,&w); dist[u][v] = min(dist[u][v],w); } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]); } } } int ans = 0; for(int i=1;i<=k;i++){ for(int j=2;j<=n;j++){ ans = max(ans, (s[j][i] - b[1][i]) / (dist[1][j] + dist[j][1])); } } cout << ans << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 612 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 612 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 612 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |