Submission #60165

# Submission time Handle Problem Language Result Execution time Memory
60165 2018-07-23T19:55:16 Z dukati8 Towns (IOI15_towns) C++14
0 / 100
26 ms 488 KB
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i =a; i<int(b); i++)
int hubDistance(int N, int sub) {
	int high=0;
	int highind=-1;
	rep(i,1,N) {
		int dist=getDistance(0,i);
		if (dist>high) {high=dist; highind=i;}
	}
	int A=highind;
	int Adists[N];
	high=0;
	highind=-1;
	rep (i,0,N) {
		Adists[i]=getDistance(A,i);
		if (Adists[i]>high) {high=Adists[i]; highind=i;}
	}
	int B=highind;
	int diameter=high;
	int Bdists[N];
	rep (i,0,N) {
		Bdists[i]=getDistance(B,i);
	}
	int pos[N];
	rep (i,0,N) {
		int extra=(Adists[i]+Bdists[i]-diameter)/2;
		pos[i]=Adists[i]-extra;
	}
	int R=diameter;
	rep (i,0,N) {
		int newr,newval;
		newr=max(pos[i],N-pos[i]);
		R=min(R,newr);
	}
	return R;
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:33:12: warning: unused variable 'newval' [-Wunused-variable]
   int newr,newval;
            ^~~~~~
towns.cpp:5:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub) {
                            ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 488 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -