제출 #542720

#제출 시각아이디문제언어결과실행 시간메모리
542720hoanghq2004도시들 (IOI15_towns)C++14
35 / 100
18 ms888 KiB
#include <bits/stdc++.h> #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "towns.h" using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 110; int d[N][N]; int dS[N], dT[N]; int hubDistance(int n, int sub) { int S = 0; for (int i = 0; i < n; ++i) dS[i] = getDistance(0, i); for (int i = 0; i < n; ++i) if (dS[i] > dS[S]) S = i; for (int i = 0; i < n; ++i) dS[i] = getDistance(S, i); int T = 0; for (int i = 0; i < n; ++i) if (dS[i] > dS[T]) T = i; for (int i = 0; i < n; ++i) dT[i] = getDistance(T, i); int R = 1e9; int h = 0; for (int i = 0; i < n; ++i) { int cur = (dS[T] + dS[i] - dT[i]) / 2; if (max(cur, dS[T] - cur) < R) { R = max(cur, dS[T] - cur); h = cur; } } if (sub < 3) return R; if (sub == 4) { int up = 0, down = 0, mid = 0; for (int i = 0; i < n; ++i) { int cur = (dS[T] + dS[i] - dT[i]) / 2; if (cur < h) ++up; if (cur > h) ++down; if (cur == h) ++mid; } if (max({up, down, mid}) <= n / 2) return R; return - R; } return R; }

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

towns.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
towns.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      |
#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...