제출 #74156

#제출 시각아이디문제언어결과실행 시간메모리
74156funcsr도시들 (IOI15_towns)C++17
0 / 100
23 ms3964 KiB
#include "towns.h" #include <iostream> #include <algorithm> #include <vector> #define rep(i, N) for (int i=0; i<(N); i++) #define pb push_back #define _1 first #define _2 second #define all(x) x.begin(), x.end() #define uniq(x) x.erase(unique(all(x)), x.end()) #define INF 1145141919 using namespace std; typedef pair<int, int> P; int N; int memo[111][111]; int Rank[111]; int dist(int a, int b) { if (memo[a][b] != -1) return memo[a][b]; return memo[a][b] = getDistance(a, b); } int saien(int x) { P mp = P(-1, -1); rep(t, N) mp = max(mp, P(dist(x, t), t)); return mp._2; } int hubDistance(int NN, int sub) { N=NN; rep(i, N) rep(j, N) memo[i][j] = -1; rep(i, N) memo[i][i] = 0; int u = saien(0); int v = saien(u); vector<int> pos; int L = dist(u, v); pos.pb(0); pos.pb(L); rep(x, N) if (x != u && x != v) { Rank[x] = dist(u, x)+dist(v, x)-dist(u, v); pos.pb(dist(u, x)-Rank[x]); } sort(all(pos)); uniq(pos); P mp = P(INF, -1); for (int x : pos) mp = min(mp, P(max(x, L-x), x)); int R = mp._1; return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:28:29: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int NN, 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...