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 <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;
int tt = 1, n;
ll x[200005], y[200005], z[200005], mx;
int main(){
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> z[i];
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
for(int k = 1; k <= n; k++){
if(i != j && i != k && j != k){
vector<pair<ll, int>> v1, v2, v3;
v1.push_back({x[i], 1});
v1.push_back({x[j], 2});
v1.push_back({x[k], 3});
v2.push_back({y[i], 1});
v2.push_back({y[j], 2});
v2.push_back({y[k], 3});
v3.push_back({z[i], 1});
v3.push_back({z[j], 2});
v3.push_back({z[k], 3});
sort(v1.rbegin(), v1.rend());
sort(v2.rbegin(), v2.rend());
sort(v3.rbegin(), v3.rend());
set<int> st;
st.insert(v1[0].second);
st.insert(v2[0].second);
st.insert(v3[0].second);
if(v1[0].first != v1[1].first && v2[0].first != v2[1].first && v3[0].first != v3[1].first && st.size() == 3)
mx = max(mx, v1[0].first + v2[0].first + v3[0].first);
}
}
}
}
if(mx == 0) cout << -1;
else cout << mx;
}
# | 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... |