제출 #1109681

#제출 시각아이디문제언어결과실행 시간메모리
1109681jerzyk도시들 (IOI15_towns)C++17
0 / 100
12 ms1244 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; #define pb push_back #define st first #define nd second typedef long long ll; typedef long double ld; const ll I = 1000'000'000'000'000'000LL; const int II = 2'000'000'000; const ll M = 1000'000'007LL; const int AN = 1007; int dis[2][AN]; void Clean(int n) { for(int r = 0; r < 2; ++r) for(int i = 0; i < n + 3; ++i) dis[r][i] = 0; } void Do(int n, int &a, int &b) { pair<int, int> ma = make_pair(-1, -1); for(int i = 1; i < n; ++i) { dis[0][i] = getDistance(0, i); ma = max(ma, make_pair(dis[0][i], -i)); } a = -ma.nd; dis[1][0] = ma.st; ma = make_pair(-1, -1); for(int i = 1; i < n; ++i) { if(i == a) continue; dis[1][i] = getDistance(a, i); ma = max(ma, make_pair(dis[1][i], -i)); } b = -ma.nd; } void Fix(vector<int> &a) { vector<int> nw; sort(a.begin(), a.end()); for(int i = 0; i < (int)a.size(); ++i) if(i == 0 || a[i] != a[i - 1]) nw.pb(a[i]); a = nw; } int hubDistance(int _N, int _sub) { //cerr << "XD\n"; Clean(_N); int n = _N; int a, b; Do(n, a, b); vector<int> pth; int xd = (dis[1][0] + dis[1][b] - dis[0][b]) / 2; for(int i = 0; i < n; ++i) { int cur = (dis[1][0] + dis[1][i] - dis[0][i]) / 2; if(cur <= xd) pth.pb(cur); } //cerr << a << " " << b << " xd " << xd << "\n"; Fix(pth); int ans = II; for(int i = 0; i < (int)pth.size(); ++i) ans = min(ans, max(pth[i], dis[1][b] - pth[i])); //cerr << ans << "\n"; return ans; }

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

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