제출 #453422

#제출 시각아이디문제언어결과실행 시간메모리
453422PedroBigMan도시들 (IOI15_towns)C++14
0 / 100
17 ms1100 KiB
#include "towns.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;

template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}

template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} 


int hubDistance(int N, int sub) 
{
	ll D;
	vector<ll> d0; d0.pb(0); REP(i,1,N) {d0.pb(getDistance(0,i));}
	ll A = (ll) (max_element(whole(d0)) - d0.begin());
	vector<ll> d1,d2;
	REP(i,0,N) {if(i==A) {d1.pb(0);} else {d1.pb(getDistance(A,i));}}
	ll B = (ll) (max_element(whole(d1)) - d1.begin());
	D = *max_element(whole(d1));
	REP(i,0,N) {if(i==B) {d2.pb(0);} else {d2.pb(getDistance(B,i));}}
	set<ll> s; 
	REP(i,0,N) {s.insert((d1[i]-d2[i]+D)/2LL);}
	ll ans = D; REP(i,0,N) {ans=min(ans,max(d1[i],d2[i]));}
	return ans;
	unordered_map<ll,ll> m; set<ll>::iterator it =  s.begin(); ll ind=0LL; while(it!=s.end()) {m[*it]=ind; ind++; it++;}
	vector<pl> p; //pairs {diameter projection index, distance to projection}
	REP(i,0,N)
	{
		ll val1 = m[(d1[i]-d2[i]+D)/2LL]; 
		ll val2 = (d1[i]+d2[i]-D)/2LL;
		p.pb({val1,val2});
	}
	
}

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

towns.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("O3")
      | 
towns.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization ("unroll-loops")
      | 
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:52:59: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   52 |  vector<ll> d0; d0.pb(0); REP(i,1,N) {d0.pb(getDistance(0,i));}
      |                                                           ^
towns.cpp:55:59: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   55 |  REP(i,0,N) {if(i==A) {d1.pb(0);} else {d1.pb(getDistance(A,i));}}
      |                                                           ^
towns.cpp:55:61: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   55 |  REP(i,0,N) {if(i==A) {d1.pb(0);} else {d1.pb(getDistance(A,i));}}
      |                                                             ^
towns.cpp:58:59: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |  REP(i,0,N) {if(i==B) {d2.pb(0);} else {d2.pb(getDistance(B,i));}}
      |                                                           ^
towns.cpp:58:61: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |  REP(i,0,N) {if(i==B) {d2.pb(0);} else {d2.pb(getDistance(B,i));}}
      |                                                             ^
towns.cpp:62:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   62 |  return ans;
      |         ^~~
towns.cpp:49:28: warning: unused parameter 'sub' [-Wunused-parameter]
   49 | int hubDistance(int N, int sub)
      |                        ~~~~^~~
#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...