Submission #1244066

#TimeUsernameProblemLanguageResultExecution timeMemory
1244066HishamAlshehriTeam Contest (JOI22_team)C++20
17 / 100
2096 ms460 KiB
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; #define int long long #define mod 1000000007 #define base 7001 #define base2 757 #define F first #define S second // #define pi acos(-1) #define double long double // #define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> // #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> // #pragma GCC optimize("O3,Ofast,unroll-loops") // #pragma GCC target("avx2,sse3,sse4,avx") mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); constexpr int maxn = 1000005; const int N = 1 << (int)(ceil(log2(maxn))); int n; array<int, 3> a[maxn]; bool b[50][50][50]; bool check(array<int, 3> x, array<int, 3> y, array<int, 3> z) { if (y[0] >= x[0] || z[0] >= x[0]) return 0; if (x[1] >= y[1] || z[1] >= y[1]) return 0; if (x[2] >= z[2] || y[2] >= z[2]) return 0; return 1; } signed main() { cin.tie(0) -> sync_with_stdio(0); cin >> n; int idx = 0; for (int i = 0; i < n; i++) { array<int, 3> t; cin >> t[0] >> t[1] >> t[2]; if (n > 300 && b[t[0]][t[1]][t[2]]) continue; a[idx] = t; idx++; if (n > 300) b[t[0]][t[1]][t[2]] = 1; } int mx = -1; for (int i = 0; i < idx; i++) { for (int j = i + 1; j < idx; j++) { for (int k = j + 1; k < idx; k++) { int t[3] = {0, 1, 2}; array<int, 3> val[3] = {a[i], a[j], a[k]}; do { if (check(val[t[0]], val[t[1]], val[t[2]])) { mx = max(val[t[0]][0] + val[t[1]][1] + val[t[2]][2], mx); // cout << val[t[0]][0] << ' ' << val[t[1]][1] << ' ' << val[t[2]][2] << ' ' << i << j << k << '\n'; } } while (next_permutation(t, t + 3)); } } } cout << mx; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...