Submission #96556

# Submission time Handle Problem Language Result Execution time Memory
96556 2019-02-10T09:35:54 Z janlivens Towns (IOI15_towns) C++14
0 / 100
17 ms 504 KB
// This  Program is made by Jan(Codezebra)
#include<bits/stdc++.h>
#include "towns.h"
using namespace std;
/*
int dist[111][111];
int calls=0;
int getDistance(int a,int b){
	calls++;
	return dist[a][b];
}

*/
int hubDistance(int n,int sub){
//	int dist[n][n];
	if(sub<3){
		int mx=0,my=0,ma=0;
	for(int i=0;i<n;i++){
	int d=getDistance(i,0);
		if(d>ma){
			ma=d;
			mx=i;
		}
	}
	ma=0;
	for(int i=0;i<n;i++){
	int d=getDistance(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=getDistance(i,mx),b=getDistance(my,mx),c=getDistance(i,my);
		ans=min(ans,max(a+b-c,max(a-b+c,-a+b+c)));
	//	cout<<ans<<"\n";
	}
	return ans/2;	
	}
}

/*int main(){
	int sub, t;
	cin>>sub>>t;
	while(t--){
		int n;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>dist[i][j];
		}
	}
	cout<<hubDistance(n,sub);
//	cout<<"calss "<<calls<<"\n";
	}
	
	
}
*/

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 400 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -