# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
52095 | Angelos | 여행하는 상인 (APIO17_merchant) | C++17 | 404 ms | 1852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstring>
#define MAXN 103
#define MAXK 1003
const long long INF = 1e10;
using namespace std;
typedef long long ll;
int N , M , K , T[MAXN][MAXN] , B[MAXN][MAXK] , S[MAXN][MAXK];
long long profit[MAXN][MAXN] , adj[MAXN][MAXN] , adj2[MAXN][MAXN] , dist[MAXN][MAXN];
bool check(ll x){
for(int i=1; i<=N; i++){
for(int j=1; j<=N; j++){
if(i == j || dist[i][j] == INF){adj[i][j] = -INF; continue;}
adj[i][j] = (ll)profit[i][j] - (ll)dist[i][j]*x;
adj[i][j] = max(-INF, adj[i][j]);
}
}
for(int k=1; k<=N; k++)
for(int i=1; i<=N; i++)
for(int j=1; j<=N; j++){
adj[i][j] = max(adj[i][j] , adj[i][k] + adj[k][j]);
if(adj[i][i] >= 0) return true;
adj[i][j] = min(INF , adj[i][j]);
adj2[i][j] = adj[i][j];
# | 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... |