# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
998295 |
2024-06-13T14:19:30 Z |
abczz |
Team Contest (JOI22_team) |
C++17 |
|
1 ms |
4540 KB |
#include <iostream>
#include <array>
#include <algorithm>
#define ll long long
using namespace std;
array <ll, 3> A[150000], B[150000], C[150000];
ll n;
int main() {
cin >> n;
for (int i=0; i<n; ++i) {
for (int j=0; j<3; ++j) {
cin >> A[i][j];
B[i][j] = C[i][j] = A[i][j];
}
}
sort(A, A+n, [](auto a, auto b) {
return a[0] > b[0];
});
sort(B, B+n, [](auto a, auto b) {
return a[1] > b[1];
});
sort(C, C+n, [](auto a, auto b) {
return a[2] > b[2];
});
int i = 0, j = 0, k = 0;
while (i < n && j < n && k < n) {
while (j < n && A[i][0] <= B[j][0]) ++j;
while (k < n && A[i][0] <= C[k][0]) ++k;
if (j >= n || k >= n) break;
while (i < n && B[j][1] <= A[i][1]) ++i;
while (k < n && B[j][1] <= C[k][1]) ++k;
if (i >= n || k >= n) break;
while (i < n && C[k][2] <= A[i][2]) ++i;
while (j < n && C[k][2] <= B[j][2]) ++j;
if (i >= n || j >= n) break;
cout << A[i][0] + B[j][1] + C[k][2] << '\n';
return 0;
}
cout << "-1\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4540 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4540 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4540 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4540 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |