답안 #206056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206056 2020-03-02T04:31:38 Z Segtree 도시들 (IOI15_towns) C++14
컴파일 오류
0 ms 0 KB
#include"towns.h"
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x,begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
int hubDistance(int N,int SUBTASK){
	int ma=0,A=-1;
	for(int i=0;i<N;i++){
		int res=getDistance(0,i);
		if(res>ma)res=ma,A=i;
	}
	int dista[110];
	ma=0,B=-1;
	for(int i=0;i<N;i++){
		int res=getDistance(A,i);
		dista[i]=res;
		if(res>ma)res=ma,B=i;
	}
	int distb[110];
	for(int i=0;i<N;i++){
		int res=getDistance(B,i);
		distb[i]=res;
	}
	int ab=dista[B];
	int ans=1e9;
	for(int i=0;i<N;i++)if(i!=A&&i!=B){
		int ax=dista[i],bx=distb[i];
		int q=(ax+bx-ab)/2;
		int p=ax-q;
		int r=bx-q;
		chmin(ans,max(p,r));
	}
	return ans;
}


Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:22:7: error: 'B' was not declared in this scope
  ma=0,B=-1;
       ^
towns.cpp:15:27: warning: unused parameter 'SUBTASK' [-Wunused-parameter]
 int hubDistance(int N,int SUBTASK){
                           ^~~~~~~