# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
774380 | vjudge1 | 여행하는 상인 (APIO17_merchant) | C++17 | 15 ms | 3148 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ve vector
#define vi vector<int>
#define vii vector<ii>
#define ii pair<int,int>
#define fi first
#define se second
#define ll long long
#define INF 1e18+7
#define pb push_back
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
tree_order_statistics_node_update>;
const int MOD = 1e9+7;
const int nax = 100+5;
const int kax = 1005;
void readio(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
ll b[nax][kax], s[nax][kax], d[nax][nax];
ve<pair<int,ll>> adj[nax];
short vis[nax];
int main()
{
optimise;
int n,m,k;
cin >> n >> m >> k;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
d[i][j] = INF;
}
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;
a--,b--;
adj[a].pb({b,c});
d[a][b] = c;
}
for (int k = 0; k < n; ++k)
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
d[i][j] = min(d[i][k]+d[k][j], d[i][j]);
ll ans = 0;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < k; ++j)
{
if(b[0][j] != -1 && s[i][j] != -1){
ans = max(ans, (s[i][j]-b[0][j])/(d[0][i]+d[i][0]));
}
}
}
cout << ans << endl;
}
컴파일 시 표준 에러 (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... |