제출 #262708

#제출 시각아이디문제언어결과실행 시간메모리
262708SorahISA여행하는 상인 (APIO17_merchant)C++11
12 / 100
20 ms2040 KiB
#pragma GCC optimize("Ofast", "unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define double long double using pii = pair<int, int>; template<typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>; template<typename T> using Prior = std::priority_queue<T>; #define X first #define Y second #define ALL(x) (x).begin(), (x).end() #define eb emplace_back #define pb push_back #define fastIO() ios_base::sync_with_stdio(false), cin.tie(0) const int INF = 0x7f7f7f7f; const int maxn = 100 + 5; const int maxk = 1000 + 5; int bs[2][maxn][maxk]; int floyd[maxn][maxn]; int32_t main() { fastIO(); int n, m, k; cin >> n >> m >> k; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= k; ++j) { cin >> bs[0][i][j] >> bs[1][i][j]; } } memset(floyd, 0x3f, sizeof(floyd)); for (int i = 0; i < m; ++i) { int u, v, w; cin >> u >> v >> w; floyd[u][v] = min(floyd[u][v], w); } for (int tr = 1; tr <= n; ++tr) { for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { floyd[i][j] = min(floyd[i][j], floyd[i][tr] + floyd[tr][j]); } } } int ans = 0; for (int i = 1; i <= n; ++i) { int maxProf = 0; for (int j = 1; j <= k; ++j) { if (bs[0][1][j] != -1) { // cerr << "owo " << bs[1][i][j] << " " << bs[1][i][j] - bs[0][1][j] << "\n"; maxProf = max(maxProf, bs[1][i][j] - bs[0][1][j]); } } // cerr << floyd[1][i] << " " << floyd[i][1] << "\n"; if (i == 1) maxProf /= floyd[1][1]; else maxProf /= floyd[1][i] + floyd[i][1]; ans = max(ans, maxProf); } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...