답안 #60216

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
60216 2018-07-23T20:59:34 Z reality 도시들 (IOI15_towns) C++17
13 / 100
25 ms 676 KB
#include "towns.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}

const int N = 256;

int D[N][N];

int hubDistance(int n, int sub) {
	for (int i = 0;i < n;++i)
		for (int j = 0;j < i;++j)
			D[i][j] = D[j][i] = getDistance(i,j);
	vi v;
	int x = 0,y = 0;
	for (int i = 0;i < n;++i)
		for (int j = 0;j < n;++j)
			if (D[i][j] > D[x][y])
				x = i,y = j;
	vi s;
	map < int , int > M;
	for (int k = 0;k < n;++k)
		if (k != x && k != y)
			++M[(D[x][y] - (D[x][k] - D[y][k])) / 2];
	int ok = 1;
	for (auto it : M)
		ok &= it.se <= (n / 2),s.pb(it.fi);
	s.pb(D[x][y]);
	sort(all(s));
	s.resize(unique(all(s)) - s.begin());
	int ans = 1e9;
	for (auto it : s)
		smin(ans,max(D[x][y] - it,it));
	return ans * (1 - 2 * ok);
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:22:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int n, int sub) {
                            ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 376 KB Output is correct
2 Correct 19 ms 612 KB Output is correct
3 Correct 3 ms 612 KB Output is correct
4 Correct 25 ms 612 KB Output is correct
5 Correct 25 ms 612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 676 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -