제출 #105186

#제출 시각아이디문제언어결과실행 시간메모리
105186CaroLinda도시들 (IOI15_towns)C++14
0 / 100
18 ms512 KiB
#include "towns.h" #include <bits/stdc++.h> #define lp(i,a,b) for(int i = a ; i < b ; i++) #define ff first #define ss second #define pii pair<int,int> #define MAXN 120 const int inf = 1e9 + 5 ; using namespace std; // int N , A , B , R = inf, man; int perp[MAXN] ; int d[MAXN][MAXN] ; // void query( int x ) { lp(i,0,N) d[x][i] = getDistance(x,i) ;} int findMax( int x ) { return max_element(d[x] , d[x] + N) - d[x] ; } int findPerpendicular( int x ) { return (d[A][x] + d[B][x] - d[A][B])/2 ; } void findRadio() { lp(i,0,N) { int fresh = max( d[A][i] , d[B][i] ) - perp[i]; if( fresh < R ) R = fresh , man = d[A][i] > d[B][i] ? A : B ; } } int sub4() { int l = 0 , r = 0 , mid = 0 ; lp(i,0,N) { int k = d[man][i] - perp[i] ; if( k < R ) l ++ ; else if ( k > R ) r ++ ; else mid ++ ; } if(l>N/2 or r > N/2 or mid > N/2) return -R ; return R ; } int hubDistance( int n , int sub) { N = n ; query(0) ; A = findMax(0) ; query(A) ; B = findMax(A) ; query(B) ; lp(i,0,n) perp[i] = findPerpendicular(i) ; findRadio() ; if( sub < 3 ) return R ; if( sub == 4 ) return sub4() ; }

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

towns.cpp: In function 'int findMax(int)':
towns.cpp:24:39: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
 { return max_element(d[x] , d[x] + N) - d[x] ; }
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...