This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Be name khoda //
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn5 = 2e5 + 10;
const int maxnt = 8e5 + 10;
const ll inf = 1e18;
int n;
int pos2[maxn5], per1[maxn5], per2[maxn5];
ll bsval2[maxn5], val1[maxn5], val2[maxn5], val3[maxn5];
vector <int> toadd;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
cin >> val1[i] >> val2[i] >> val3[i];
}
ll ans = -1;
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < n; k++)
if(val1[i] > val1[j] && val1[i] > val1[k])
if(val2[j] > val2[i] && val2[j] > val2[k])
if(val3[k] > val3[i] && val3[k] > val3[j])
ans = max(ans, val1[i] + val2[j] + val3[k]);
cout << ans << endl;
}
# | 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... |