제출 #1072401

#제출 시각아이디문제언어결과실행 시간메모리
1072401Zicrus도시들 (IOI15_towns)C++17
0 / 100
12 ms976 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; typedef long long ll; int hubDistance(int n, int sub) { ll a = 0, b = 0; ll mxDist = 0; for (int i = 1; i < n; i++) { ll val = getDistance(0, i); if (val > mxDist) { mxDist = val; a = i; } } mxDist = 0; for (int i = 1; i < n; i++) { ll val = getDistance(a, i); if (val > mxDist) { mxDist = val; b = i; } } ll res = 1ll << 62ll; for (int i = 0; i < n; i++) { if (i == a || i == b) continue; ll distA = getDistance(i, a); ll distB = getDistance(i, b); ll nw = (distA + distB - mxDist) / 2; distA -= nw; distB -= nw; ll val = max(distA, distB); res = min(res, val); } return res; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:19:30: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   19 |         ll val = getDistance(a, i);
      |                              ^
towns.cpp:28:35: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   28 |         ll distA = getDistance(i, a);
      |                                   ^
towns.cpp:29:35: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   29 |         ll distB = getDistance(i, b);
      |                                   ^
towns.cpp:36:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   36 |     return res;
      |            ^~~
towns.cpp:7:28: warning: unused parameter 'sub' [-Wunused-parameter]
    7 | 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...