제출 #590980

#제출 시각아이디문제언어결과실행 시간메모리
590980AlperenTTowns (IOI15_towns)C++17
25 / 100
14 ms1092 KiB
#include <bits/stdc++.h>
#include "towns.h"

using namespace std;

const int INF = 1e9 + 5;

int hubDistance(int n, int sub){
	if(sub == 3){

	}
	else{
		int dist0[n];

		for(int i = 0; i < n; i++) dist0[i] = getDistance(0, i);

		int A = max_element(dist0, dist0 + n) - dist0;

		int distA[n];

		for(int i = 0; i < n; i++) distA[i] = getDistance(A, i);

		int B = max_element(distA, distA + n) - distA;

		int distB[n];

		for(int i = 0; i < n; i++) distB[i] = getDistance(B, i);

		map<pair<int, int>, vector<int>> mp;

		for(int C = 0; C < n; C++){
			int xtoc = (distA[C] + distB[C] - distA[B]) / 2;

			mp[{distA[C] - xtoc, distB[C] - xtoc}].push_back(xtoc);
		}

		int mn = INF;

		for(auto p : mp) mn = min(mn, max(p.first.first, p.first.second));

		if(sub == 1 || sub == 2) return mn;
		else{
			
		}

		int R = getDistance(0,1);
		return R;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:17:41: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   17 |   int A = max_element(dist0, dist0 + n) - dist0;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
towns.cpp:23:41: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   23 |   int B = max_element(distA, distA + n) - distA;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
towns.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...