제출 #785271

#제출 시각아이디문제언어결과실행 시간메모리
785271ymm도시들 (IOI15_towns)C++17
25 / 100
19 ms352 KiB
#include "towns.h" #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x) typedef std::pair<int,int> pii; typedef long long ll; using namespace std; const int N = 120; int dis0[N], disa[N], disb[N]; int hubDistance(int n, int sub) { Loop (i,0,n) dis0[i] = getDistance(0, i); int a = max_element(dis0, dis0+n) - dis0; Loop (i,0,n) disa[i] = getDistance(a, i); int b = max_element(disa, disa+n) - disa; Loop (i,0,n) disb[i] = getDistance(b, i); int ans = 1e9; Loop (i,0,n) { int x = (disa[i] + disa[b] - disb[i])/2; int y = (disb[i] + disb[a] - disa[i])/2; ans = min(ans, max(x, y)); } return ans; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:14:28: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   14 |   dis0[i] = getDistance(0, i);
      |                            ^
towns.cpp:15:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   15 |  int a = max_element(dis0, dis0+n) - dis0;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:17:28: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   17 |   disa[i] = getDistance(a, i);
      |                            ^
towns.cpp:18:36: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   18 |  int b = max_element(disa, disa+n) - disa;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
towns.cpp:20:28: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   20 |   disb[i] = getDistance(b, i);
      |                            ^
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...