제출 #1080039

#제출 시각아이디문제언어결과실행 시간메모리
1080039Trumling도시들 (IOI15_towns)C++14
25 / 100
21 ms1096 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define all(x) x.begin(),x.end() #define INF 9999999999999 typedef long long ll; int hubDistance(int N, int sub) { ll n=N; vector<vector<ll>>g(N,vector<ll>(N,-1)); ll maxi=-1; pair<ll,ll>curr; ll p1=0; for(int j=1;j<n;j++) { ll R=getDistance(0,j); g[0][j]=R; g[j][0]=R; if(maxi<R) { maxi=R; p1=j; } } curr={0,p1}; for(int i=1;i<n;i++) if(i!=p1) { ll R=getDistance(i,p1); g[i][p1]=R; g[p1][i]=R; if(maxi<R) { maxi=R; curr={p1,i}; } } ll ans=INF; for(int i=0;i<n;i++) if(i!=curr.F && i!=curr.S) { if(g[i][curr.F]==-1) { ll R=getDistance(i,curr.F); g[i][curr.F]=R; g[curr.F][i]=R; } if(g[i][curr.S]==-1) { ll R=getDistance(i,curr.S); g[i][curr.S]=R; g[curr.S][i]=R; } ll f=(g[i][curr.F] + g[i][curr.S] - maxi)/2; ans=min(ans,max(g[i][curr.F]-f,g[i][curr.S]-f)); } return ans; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:36:23: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   36 |    ll R=getDistance(i,p1);
      |                       ^~
towns.cpp:5:11: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
    5 | #define F first
      |           ^
towns.cpp:54:29: note: in expansion of macro 'F'
   54 |     ll R=getDistance(i,curr.F);
      |                             ^
towns.cpp:6:11: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
    6 | #define S second
      |           ^
towns.cpp:61:29: note: in expansion of macro 'S'
   61 |     ll R=getDistance(i,curr.S);
      |                             ^
towns.cpp:70:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   70 |  return ans;
      |         ^~~
towns.cpp:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
   12 | 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...