제출 #718969

#제출 시각아이디문제언어결과실행 시간메모리
718969Karuk도시들 (IOI15_towns)C++14
0 / 100
12 ms348 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; map<pair<int,int>,long long>m; long long getD(int x,int y) { return getDistance(x,y); if(x==y)return 0; if(m[{x,y}]!=0)return m[{x,y}]; m[{x,y}]=m[{y,x}]=getDistance(x,y); return m[{x,y}]; } long long getmindist(int f,int s,int t) { long long d1=getD(f,s); long long d2=getD(s,t); long long d3=getD(f,t); long long dd=(d1+d2-d3)/2; long long d=(d1+d3-d2)/2; long long ddd=(d2+d3-d1)/2; return max(max(d,dd),ddd); } int hubDistance(int n,int sub) { int maxd=0,maxind=0; int md=0; for(int i=1;i<n;i++) { long long p=getD(0,i); if(maxd<p) { maxd=p; maxind=i; } } md=maxind; maxd=0; maxind=0; for(int i=0;i<n;i++) { if(i==md)continue; long long p=getD(md,i); if(maxd<p) { maxd=p; maxind=i; } } long long minr=1e12; for(int i=0;i<n;i++) { minr=min(minr,getmindist(i,md,maxind)); } return minr; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:27:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   27 |             maxd=p;
      |                  ^
towns.cpp:38:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   38 |             maxd=p;
      |                  ^
towns.cpp:46:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |     return minr;
      |            ^~~~
towns.cpp:21:27: warning: unused parameter 'sub' [-Wunused-parameter]
   21 | 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...