// 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 |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
56 ms |
340 KB |
Output is correct |
15 |
Correct |
22 ms |
336 KB |
Output is correct |
16 |
Correct |
42 ms |
340 KB |
Output is correct |
17 |
Correct |
42 ms |
340 KB |
Output is correct |
18 |
Correct |
51 ms |
340 KB |
Output is correct |
19 |
Correct |
69 ms |
356 KB |
Output is correct |
20 |
Correct |
39 ms |
340 KB |
Output is correct |
21 |
Correct |
27 ms |
336 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
22 ms |
340 KB |
Output is correct |
24 |
Correct |
37 ms |
340 KB |
Output is correct |
25 |
Correct |
29 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
56 ms |
340 KB |
Output is correct |
15 |
Correct |
22 ms |
336 KB |
Output is correct |
16 |
Correct |
42 ms |
340 KB |
Output is correct |
17 |
Correct |
42 ms |
340 KB |
Output is correct |
18 |
Correct |
51 ms |
340 KB |
Output is correct |
19 |
Correct |
69 ms |
356 KB |
Output is correct |
20 |
Correct |
39 ms |
340 KB |
Output is correct |
21 |
Correct |
27 ms |
336 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
22 ms |
340 KB |
Output is correct |
24 |
Correct |
37 ms |
340 KB |
Output is correct |
25 |
Correct |
29 ms |
336 KB |
Output is correct |
26 |
Execution timed out |
2045 ms |
468 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2045 ms |
4344 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2045 ms |
4344 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2045 ms |
4344 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2045 ms |
4344 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
56 ms |
340 KB |
Output is correct |
15 |
Correct |
22 ms |
336 KB |
Output is correct |
16 |
Correct |
42 ms |
340 KB |
Output is correct |
17 |
Correct |
42 ms |
340 KB |
Output is correct |
18 |
Correct |
51 ms |
340 KB |
Output is correct |
19 |
Correct |
69 ms |
356 KB |
Output is correct |
20 |
Correct |
39 ms |
340 KB |
Output is correct |
21 |
Correct |
27 ms |
336 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
22 ms |
340 KB |
Output is correct |
24 |
Correct |
37 ms |
340 KB |
Output is correct |
25 |
Correct |
29 ms |
336 KB |
Output is correct |
26 |
Execution timed out |
2045 ms |
468 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |