#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#define int long long
#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
int getMax(int* data, int size) {
bool isSame = false;
int best = 0;
for (int i = 1; i < size; i++) {
if (data[i] > data[best]) {
best = i;
isSame = false;
}
else if (data[i] == data[best])
isSame = true;
}
if (isSame) return -1;
return best;
}
signed main() {
int n;
cin >> n;
struct Beaver {
int x, y, z;
};
vector<Beaver> beavers(n);
loop(i, n) {
cin >> beavers[i].x >> beavers[i].y >> beavers[i].z;
}
int bestScore = -1;
loop(i, n) {
loop(j, i) {
loop(k, j) {
int x[3] = { beavers[i].x, beavers[j].x, beavers[k].x };
int y[3] = { beavers[i].y, beavers[j].y, beavers[k].y };
int z[3] = { beavers[i].z, beavers[j].z, beavers[k].z };
int maxX = getMax(x, 3);
int maxY = getMax(y, 3);
int maxZ = getMax(z, 3);
if (maxX == maxY || maxX == maxZ || maxY == maxZ || maxX == -1 || maxY == -1 || maxZ == -1) continue;
bestScore = max(bestScore, x[maxX] + y[maxY] + z[maxZ]);
}
}
}
cout << bestScore << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
27 ms |
348 KB |
Output is correct |
15 |
Correct |
11 ms |
348 KB |
Output is correct |
16 |
Correct |
19 ms |
444 KB |
Output is correct |
17 |
Correct |
25 ms |
348 KB |
Output is correct |
18 |
Correct |
28 ms |
420 KB |
Output is correct |
19 |
Correct |
33 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
436 KB |
Output is correct |
21 |
Correct |
22 ms |
348 KB |
Output is correct |
22 |
Correct |
14 ms |
444 KB |
Output is correct |
23 |
Correct |
19 ms |
440 KB |
Output is correct |
24 |
Correct |
16 ms |
444 KB |
Output is correct |
25 |
Correct |
20 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
27 ms |
348 KB |
Output is correct |
15 |
Correct |
11 ms |
348 KB |
Output is correct |
16 |
Correct |
19 ms |
444 KB |
Output is correct |
17 |
Correct |
25 ms |
348 KB |
Output is correct |
18 |
Correct |
28 ms |
420 KB |
Output is correct |
19 |
Correct |
33 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
436 KB |
Output is correct |
21 |
Correct |
22 ms |
348 KB |
Output is correct |
22 |
Correct |
14 ms |
444 KB |
Output is correct |
23 |
Correct |
19 ms |
440 KB |
Output is correct |
24 |
Correct |
16 ms |
444 KB |
Output is correct |
25 |
Correct |
20 ms |
436 KB |
Output is correct |
26 |
Execution timed out |
2088 ms |
348 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
424 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
2098 ms |
2952 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
424 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
2098 ms |
2952 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
424 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
2098 ms |
2952 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
424 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Execution timed out |
2098 ms |
2952 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
384 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
27 ms |
348 KB |
Output is correct |
15 |
Correct |
11 ms |
348 KB |
Output is correct |
16 |
Correct |
19 ms |
444 KB |
Output is correct |
17 |
Correct |
25 ms |
348 KB |
Output is correct |
18 |
Correct |
28 ms |
420 KB |
Output is correct |
19 |
Correct |
33 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
436 KB |
Output is correct |
21 |
Correct |
22 ms |
348 KB |
Output is correct |
22 |
Correct |
14 ms |
444 KB |
Output is correct |
23 |
Correct |
19 ms |
440 KB |
Output is correct |
24 |
Correct |
16 ms |
444 KB |
Output is correct |
25 |
Correct |
20 ms |
436 KB |
Output is correct |
26 |
Execution timed out |
2088 ms |
348 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |