Submission #96562

# Submission time Handle Problem Language Result Execution time Memory
96562 2019-02-10T10:16:54 Z janlivens Towns (IOI15_towns) C++14
25 / 100
53 ms 952 KB
// This  Program is made by Jan(Codezebra)
#include<bits/stdc++.h>
#include "towns.h"
using namespace std;

int table[111][111];

int get(int i,int j){
	if(table[i][j]==-1){
		table[i][j]=getDistance(i,j);
		table[j][i]=table[i][j];
	}
	return table[i][j];
}

int hubDistance(int n,int sub){
	
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			table[i][j]=-1;
		}
	}
	if(sub<3){
		int mx=0,my=0,ma=0;
	for(int i=0;i<n;i++){
	int d=get(i,0);
		if(d>ma){
			ma=d;
			mx=i;
		}
	}
	ma=0;
	for(int i=0;i<n;i++){
	int d=get(i,mx);
		if(d>ma){
			ma=d;
			my=i;
		}
	}
//	cout<<mx<<" "<<my<<"\n";
	int ans=1e7;
	for(int i=0;i<n;i++){
		int a=get(i,mx),b=get(my,mx),c=get(i,my);
		ans=min(ans,max(a+b-c,max(a-b+c,-a+b+c)));
//		cout<<ans<<"\n";
	}
	return ans/2;	
	}
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 16 ms 376 KB Output is correct
2 Correct 14 ms 888 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 29 ms 888 KB Output is correct
5 Correct 19 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 376 KB Output is correct
2 Correct 17 ms 892 KB Output is correct
3 Correct 18 ms 888 KB Output is correct
4 Correct 20 ms 952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -