#include <bits/stdc++.h>
using namespace std;
int B[101][1000], S[101][1000], E[101][101];
int main(){
ios_base::sync_with_stdio(0), cin.tie(0);
int N,M,K; cin>>N>>M>>K;
for(int i=1; i<=N; ++i) for(int j=0; j<K; ++j) cin>>B[i][j]>>S[i][j];
for(int i=0; i<M; ++i){
int a,b,c; cin>>a>>b>>c;
E[a][b] = c;
}
for(int x=1; x<=N; ++x) for(int i=1; i<=N; ++i) for(int j=1; j<=N; ++j)
if(E[i][x] && E[x][j] && (!E[i][j] || E[i][j] > E[i][x]+E[x][j])) E[i][j] = E[i][x]+E[x][j];
int ans = 0;
for(int i=1; i<=N; ++i){
for(int j=1; j<=N; ++j){
if(i==j || !E[i][j] || !E[j][i]) continue;
int t = 0;
for(int k=0; k<K; ++k) if(S[j][k]>0 && B[i][k]>0) t = max(t, S[j][k]-B[i][k]);
ans = max(ans, t/(E[i][j]+E[j][i]));
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
2424 KB |
Output is correct |
2 |
Correct |
4 ms |
1152 KB |
Output is correct |
3 |
Correct |
4 ms |
1152 KB |
Output is correct |
4 |
Correct |
3 ms |
768 KB |
Output is correct |
5 |
Correct |
3 ms |
768 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
768 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
3 ms |
768 KB |
Output is correct |
11 |
Correct |
2 ms |
768 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |