제출 #424651

#제출 시각아이디문제언어결과실행 시간메모리
424651MarcoMeijer도시들 (IOI15_towns)C++14
25 / 100
21 ms392 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; // macros typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> lll; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; typedef vector<lll> vlll; #define REP(a,b,c) for(int a=int(b); a<int(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--) #define FOR(a,b) for(auto& a : b) #define all(a) a.begin(), a.end() #define INF 1e9 #define EPS 1e-9 #define pb push_back #define popb pop_back #define fi first #define se second #define sz size() mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // output template<class T1, class T2> void OUT(const pair<T1,T2>& x); template<class T> void OUT(const vector<T>& x); template<class T> void OUT(const T& x) {cerr << x;} template<class H, class... T> void OUT(const H& h, const T&... t) {OUT(h); OUT(t...); } template<class T1, class T2> void OUT(const pair<T1,T2>& x) {OUT(x.fi,' ',x.se);} template<class T> void OUT(const vector<T>& x) {RE(i,x.size()) OUT(i==0?"":" ",x[i]);} template<class... T> void OUTL(const T&... t) {OUT(t..., "\n"); } template<class H> void OUTLS(const H& h) {OUTL(h); } template<class H, class... T> void OUTLS(const H& h, const T&... t) {OUT(h,' '); OUTLS(t...); } const int MX = 120; static int mem[MX][MX]; int n; int getD(int u, int v) { if(mem[u][v] != -1) return mem[u][v]; return mem[u][v] = mem[v][u] = getDistance(u,v); } int hubDistance(int N, int sub) { n = N; RE(i,n) RE(j,n) mem[i][j] = -1; RE(i,n) mem[i][i] = 0; int u = 0, v=0; RE(i,n) if(getD(u,i) > getD(u,v)) v = i; RE(i,n) if(getD(v,i) > getD(u,v)) u = i; int res = getD(u,v); RE(i,n) { int nres = getD(0,i) + getD(v,i) - getD(0,v); nres /= 2; nres = getD(v,i) - nres; nres = max(nres, getD(u,v)-nres); res = min(res, nres); } return res; }

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

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