제출 #60222

#제출 시각아이디문제언어결과실행 시간메모리
60222reality도시들 (IOI15_towns)C++17
25 / 100
46 ms2424 KiB
#include "towns.h" #include "bits/stdc++.h" using namespace std; #define fi first #define se second #define ll long long #define dbg(v) cerr<<#v<<" = "<<v<<'\n' #define vi vector<int> #define vl vector <ll> #define pii pair<int,int> #define mp make_pair #define db long double #define pb push_back #define all(s) s.begin(),s.end() template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;} template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;} const int N = 256; int D[N][N]; int get(int x,int y) { if (D[x][y] != -1) return D[x][y]; return D[x][y] = D[y][x] = getDistance(x,y); } int hubDistance(int n, int sub) { memset(D,-1,sizeof(D)); //cerr << x << ' ' << y << ' ' << mx << '\n'; int x = 0; for (int i = 0;i < n;++i) D[i][i] = 0; for (int i = 0;i < n;++i) if (get(0,i) > get(0,x)) x = i; int y = x; for (int i = 0;i < n;++i) if (get(x,i) > get(x,y)) y = i; vi s; pii ans = mp((int)(2e9),0); map < int , int > M; for (int k = 0;k < n;++k) if (k != x && k != y) ++M[(get(x,y) - (get(x,k) - get(y,k))) / 2]; int ok = 1; for (auto it : M) ok &= it.se <= (n / 2),s.pb(it.fi); s.pb(D[x][y]); sort(all(s)); s.resize(unique(all(s)) - s.begin()); for (auto it : s) smin(ans,mp(max(D[x][y] - it,it),ok)); return ans.fi * (1 - 2 * ans.se); }

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

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