제출 #302394

#제출 시각아이디문제언어결과실행 시간메모리
302394square1001도시들 (IOI15_towns)C++14
13 / 100
23 ms896 KiB
#include "towns.h" #include <cmath> #include <vector> #include <iostream> #include <algorithm> using namespace std; int hubDistance(int N, int sub) { if(sub <= 2) { vector<int> da(N); for(int i = 1; i < N; ++i) { da[i] = getDistance(0, i); } int ma = max_element(da.begin(), da.end()) - da.begin(); vector<int> db(N); for(int i = 0; i < N; ++i) { if(i != ma) { db[i] = getDistance(ma, i); } } int mb = max_element(db.begin(), db.end()) - db.begin(); int mindiff = (1 << 30); for(int i = 0; i < N; ++i) { if(i != ma && i != mb) { int dx = getDistance(ma, i); int dy = getDistance(mb, i); mindiff = min(mindiff, abs(dx - dy)); } } return (db[mb] + mindiff) / 2; } else { // write code here } return 0; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:13:46: warning: conversion from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   13 |   int ma = max_element(da.begin(), da.end()) - da.begin();
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
towns.cpp:20:46: warning: conversion from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'} to 'int' may change value [-Wconversion]
   20 |   int mb = max_element(db.begin(), db.end()) - db.begin();
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#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...