Submission #52091

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
520912018-06-23 20:30:29AngelosTravelling Merchant (APIO17_merchant)C++14
21 / 100
262 ms1096 KiB
#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] ;
long long profit[MAXN][MAXN] , adj[MAXN][MAXN] , adj2[MAXN][MAXN] , B[MAXN][MAXN] , S[MAXN][MAXN] , dist[MAXN][MAXN];
bool check(int 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];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...