結果
問題 | No.1045 直方体大学 |
ユーザー | stoq |
提出日時 | 2021-08-04 20:30:44 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,500 bytes |
コンパイル時間 | 2,833 ms |
コンパイル使用メモリ | 213,428 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-16 15:10:13 |
合計ジャッジ時間 | 3,081 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/specfun.h:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/cmath:1935, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:41, from main.cpp:5: In function 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int*; _Tp = int]', inlined from 'void std::__fill_a1(__gnu_cxx::__normal_iterator<_Iterator, _Container>, __gnu_cxx::__normal_iterator<_Iterator, _Container>, const _Tp&) [with _Ite = int*; _Cont = vector<int>; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:951:21, inlined from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:968:21, inlined from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Tp = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:998:20, inlined from 'void BellmanFord<T>::calc(int) [with T = int]' at main.cpp:145:9, inlined from 'void solve()' at main.cpp:256:10: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:920:17: warning: 'bf.BellmanFord<int>::INF' may be used uninitialized [-Wmaybe-uninitialized] 920 | const _Tp __tmp = __value; | ^~~~~ main.cpp: In function 'void solve()': main.cpp:223:20: note: 'bf' declared here 223 | BellmanFord<int> bf(n * 3 + 1, INF); | ^~
ソースコード
#define MOD_TYPE 1 #pragma region Macros #include <bits/stdc++.h> using namespace std; #if 1 #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #endif #if 0 #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; template <typename T> using extset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #endif #if 0 #include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> using Int = boost::multiprecision::cpp_int; using lld = boost::multiprecision::cpp_dec_float_100; #endif using ll = long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; template <typename T> using smaller_queue = priority_queue<T, vector<T>, greater<T>>; constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353); constexpr int INF = (int)1e9 + 10; constexpr ll LINF = (ll)4e18; constexpr ld PI = acos(-1.0); constexpr ld EPS = 1e-7; constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0}; constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0}; #define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define REPI(i, m, n) for (int i = m; i < (int)(n); ++i) #define repi(i, n) REPI(i, 0, n) #define MP make_pair #define MT make_tuple #define YES(n) cout << ((n) ? "YES" : "NO") << "\n" #define Yes(n) cout << ((n) ? "Yes" : "No") << "\n" #define possible(n) cout << ((n) ? "possible" : "impossible") << "\n" #define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n" #define all(v) v.begin(), v.end() #define NP(v) next_permutation(all(v)) #define dbg(x) cerr << #x << ":" << x << "\n"; struct io_init { io_init() { cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(30) << setiosflags(ios::fixed); }; } io_init; template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } inline ll CEIL(ll a, ll b) { return (a + b - 1) / b; } template <typename A, size_t N, typename T> inline void Fill(A (&array)[N], const T &val) { fill((T *)array, (T *)(array + N), val); } template <typename T, typename U> constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept { is >> p.first >> p.second; return is; } template <typename T, typename U> constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept { os << p.first << " " << p.second; return os; } #pragma endregion random_device seed_gen; mt19937_64 engine(seed_gen()); // -------------------------------------- template <typename T> struct BellmanFord { struct edge { int from, to; T cost; }; int V; T INF; vector<edge> E; vector<T> d; vector<bool> negative; BellmanFord(int V, T INF = 4e18) : V(V), d(V), negative(V) {} void add_edge(int a, int b, T c, bool directed = true) { E.push_back(edge{a, b, c}); if (!directed) E.push_back(edge{b, a, c}); } void calc(int s) { fill(all(d), INF); d[s] = 0; bool update; while (1) { update = false; for (auto e : E) { if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) { d[e.to] = d[e.from] + e.cost; update = true; } } if (!update) return; } } bool calc_and_find_negative_loop(int s, int g = -1) { fill(all(d), INF); fill(all(negative), false); d[s] = 0; rep(i, V) { bool update = false; for (auto e : E) { if (d[e.from] != LINF && d[e.to] > d[e.from] + e.cost) { d[e.to] = d[e.from] + e.cost; update = true; if (i == V - 1) negative[e.from] = negative[e.to] = true; } } if (!update) return false; } if (g == -1) { rep(i, V) { if (negative[i]) return true; } return false; } else { return negative[g]; } } bool find_any_negative_loop() { vector<T> d_(V); rep(i, V) for (auto e : E) { if (d_[e.to] > d_[e.from] + e.cost) { d_[e.to] = d_[e.from] + e.cost; if (i == V - 1) return true; } } return false; } }; void solve() { int n; cin >> n; int a[16][3]; rep(i, n) rep(j, 3) cin >> a[i][j]; BellmanFord<int> bf(n * 3 + 1, INF); const int S = n * 3; rep(i, n) rep(j, n) { if (i == j) continue; if (a[i][0] >= a[j][0] and a[i][1] >= a[j][1]) ; rep(k, 3) rep(l, 3) { int h1 = a[i][k], h2 = a[j][l]; int a1, b1; if (k == 0) a1 = a[i][1], b1 = a[i][2]; if (k == 1) a1 = a[i][0], b1 = a[i][2]; if (k == 2) a1 = a[i][0], b1 = a[i][1]; int a2, b2; if (l == 0) a2 = a[j][1], b2 = a[j][2]; if (l == 1) a2 = a[j][0], b2 = a[j][2]; if (l == 2) a2 = a[j][0], b2 = a[j][1]; if (a1 < a2 and b1 < b2 or a1 < b2 and b1 < a2) bf.add_edge(i + n * k, j + n * l, -h2); } } rep(i, n) rep(k, 3) { bf.add_edge(S, i + n * k, -a[i][k]); } bf.calc(S); int ans = 0; rep(i, n * 3) chmax(ans, -bf.d[i]); cout << ans << "\n"; } int main() { solve(); }