//
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
using namespace std;
const int maxn=3e5+10,LOG=17,mod=1e9+7;
int block = 320, timer = 0;
const ld EPS = 1e-18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define bt(i) (1 << (i))
#define int ll
const int inf=2e18;
#define y1 yy
#define prev pre
#define pii pair <int, int>
int n, a[maxn], b[maxn], c[maxn];
main()
{
cin >> n;
forn(1, i, n)
{
cin >> a[i] >> b[i] >> c[i];
}
int ans = -inf;
forn(1, i, n)
{
forn(1, j, n)
{
forn(1, k, n)
{
if(a[i] > max(a[j], a[k]) && b[j] > max(b[i], b[k]) && c[k] > max(c[i], c[j]))
{
ans = max(ans, a[i] + b[j] + c[k]);
}
}
}
}
if(ans == -inf) cout << "-1";
else
cout << ans;
}
Compilation message
team.cpp:34:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
34 | main()
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
260 KB |
Output is correct |
14 |
Correct |
57 ms |
316 KB |
Output is correct |
15 |
Correct |
21 ms |
324 KB |
Output is correct |
16 |
Correct |
32 ms |
212 KB |
Output is correct |
17 |
Correct |
39 ms |
212 KB |
Output is correct |
18 |
Correct |
40 ms |
212 KB |
Output is correct |
19 |
Correct |
48 ms |
300 KB |
Output is correct |
20 |
Correct |
36 ms |
212 KB |
Output is correct |
21 |
Correct |
35 ms |
300 KB |
Output is correct |
22 |
Correct |
34 ms |
300 KB |
Output is correct |
23 |
Correct |
29 ms |
212 KB |
Output is correct |
24 |
Correct |
24 ms |
324 KB |
Output is correct |
25 |
Correct |
24 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
260 KB |
Output is correct |
14 |
Correct |
57 ms |
316 KB |
Output is correct |
15 |
Correct |
21 ms |
324 KB |
Output is correct |
16 |
Correct |
32 ms |
212 KB |
Output is correct |
17 |
Correct |
39 ms |
212 KB |
Output is correct |
18 |
Correct |
40 ms |
212 KB |
Output is correct |
19 |
Correct |
48 ms |
300 KB |
Output is correct |
20 |
Correct |
36 ms |
212 KB |
Output is correct |
21 |
Correct |
35 ms |
300 KB |
Output is correct |
22 |
Correct |
34 ms |
300 KB |
Output is correct |
23 |
Correct |
29 ms |
212 KB |
Output is correct |
24 |
Correct |
24 ms |
324 KB |
Output is correct |
25 |
Correct |
24 ms |
320 KB |
Output is correct |
26 |
Execution timed out |
2065 ms |
340 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
3928 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
3928 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
3928 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
3928 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
260 KB |
Output is correct |
14 |
Correct |
57 ms |
316 KB |
Output is correct |
15 |
Correct |
21 ms |
324 KB |
Output is correct |
16 |
Correct |
32 ms |
212 KB |
Output is correct |
17 |
Correct |
39 ms |
212 KB |
Output is correct |
18 |
Correct |
40 ms |
212 KB |
Output is correct |
19 |
Correct |
48 ms |
300 KB |
Output is correct |
20 |
Correct |
36 ms |
212 KB |
Output is correct |
21 |
Correct |
35 ms |
300 KB |
Output is correct |
22 |
Correct |
34 ms |
300 KB |
Output is correct |
23 |
Correct |
29 ms |
212 KB |
Output is correct |
24 |
Correct |
24 ms |
324 KB |
Output is correct |
25 |
Correct |
24 ms |
320 KB |
Output is correct |
26 |
Execution timed out |
2065 ms |
340 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |