# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
556198 | 600Mihnea | Team Contest (JOI22_team) | C++17 | 2067 ms | 2508 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
bool home = 1;
using namespace std;
struct T {
int x;
int y;
int z;
};
bool cmp_x_inv(T a,T b) {
return a.x>b.x;
}
typedef long long ll;
const int N=150000+7;
int n;
T a[N];
signed main() {
#ifdef ONLINE_JUDGE
home = 0;
#endif
home=0;
if (home) {
freopen("I_am_iron_man", "r", stdin);
}
else {
ios::sync_with_stdio(0); cin.tie(0);
}
cin>>n;
for (int i=1;i<=n;i++) {
cin>>a[i].x>>a[i].y>>a[i].z;
}
sort(a+1,a+n+1,cmp_x_inv);
int sol=-1;
for (int i=1;i<=n;i++) {
for (int j=i+1;j<=n;j++) {
for (int k=j+1;k<=n;k++) {
if (a[i].x>max(a[j].x,a[k].x)) {
if (a[j].y>max(a[i].y,a[k].y) && a[k].z>max(a[i].z,a[j].z)) sol=max(sol,a[i].x+a[j].y+a[k].z);
if (a[j].z>max(a[i].z,a[k].z) && a[k].y>max(a[i].y,a[j].y)) sol=max(sol,a[i].x+a[j].z+a[k].y);
}
}
}
}
cout<<sol<<"\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |