#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
const int mod = 1e9 + 7;
const long long infl = 1e18 + 1;
const int inf = 1e9 + 1;
template<typename T>
int len(T &a){
return a.size();
}
struct type{
int a, b, c;
};
void solve(){
int n; cin >> n;
vector<type> v(n);
for(auto &[a, b, c] : v) cin >> a >> b >> c;
sort(all(v), [&](type a, type b){
return a.a < b.a;
});
auto brute = [&](){
assert(n <= 300);
int res = -1;
for(int i = 0; i < n; i ++){
for(int j = 0; j < n; j ++){
for(int k = 0; k < n; k ++){
if(v[i].a > v[j].a && v[i].a > v[k].a && v[j].b > v[i].b && v[j].b > v[k].b && v[k].c > v[i].c && v[k].c > v[j].c){
res = max(res, v[i].a + v[j].b + v[k].c);
}
}
}
}
return res;
};
cout << brute();
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int testcases = 1;
// cin >> testcases;
while(testcases --){
solve();
if(testcases){
cout << '\n';
}
#ifdef LOCAL
else
cout << '\n';
cout << "______________" << endl;
#endif
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
456 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
42 ms |
348 KB |
Output is correct |
15 |
Correct |
14 ms |
348 KB |
Output is correct |
16 |
Correct |
21 ms |
464 KB |
Output is correct |
17 |
Correct |
29 ms |
348 KB |
Output is correct |
18 |
Correct |
29 ms |
344 KB |
Output is correct |
19 |
Correct |
34 ms |
344 KB |
Output is correct |
20 |
Correct |
25 ms |
344 KB |
Output is correct |
21 |
Correct |
19 ms |
348 KB |
Output is correct |
22 |
Correct |
21 ms |
348 KB |
Output is correct |
23 |
Correct |
18 ms |
348 KB |
Output is correct |
24 |
Correct |
27 ms |
344 KB |
Output is correct |
25 |
Correct |
23 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
456 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
42 ms |
348 KB |
Output is correct |
15 |
Correct |
14 ms |
348 KB |
Output is correct |
16 |
Correct |
21 ms |
464 KB |
Output is correct |
17 |
Correct |
29 ms |
348 KB |
Output is correct |
18 |
Correct |
29 ms |
344 KB |
Output is correct |
19 |
Correct |
34 ms |
344 KB |
Output is correct |
20 |
Correct |
25 ms |
344 KB |
Output is correct |
21 |
Correct |
19 ms |
348 KB |
Output is correct |
22 |
Correct |
21 ms |
348 KB |
Output is correct |
23 |
Correct |
18 ms |
348 KB |
Output is correct |
24 |
Correct |
27 ms |
344 KB |
Output is correct |
25 |
Correct |
23 ms |
348 KB |
Output is correct |
26 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
22 ms |
4944 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
22 ms |
4944 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
22 ms |
4944 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
600 KB |
Output is correct |
4 |
Correct |
0 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
22 ms |
4944 KB |
Execution killed with signal 6 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
456 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
42 ms |
348 KB |
Output is correct |
15 |
Correct |
14 ms |
348 KB |
Output is correct |
16 |
Correct |
21 ms |
464 KB |
Output is correct |
17 |
Correct |
29 ms |
348 KB |
Output is correct |
18 |
Correct |
29 ms |
344 KB |
Output is correct |
19 |
Correct |
34 ms |
344 KB |
Output is correct |
20 |
Correct |
25 ms |
344 KB |
Output is correct |
21 |
Correct |
19 ms |
348 KB |
Output is correct |
22 |
Correct |
21 ms |
348 KB |
Output is correct |
23 |
Correct |
18 ms |
348 KB |
Output is correct |
24 |
Correct |
27 ms |
344 KB |
Output is correct |
25 |
Correct |
23 ms |
348 KB |
Output is correct |
26 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
27 |
Halted |
0 ms |
0 KB |
- |