#include<bits/stdc++.h>
using namespace std;
#pragma gcc optimize('ofast','unroll-loops')
#define endl '\n'
#define ff first
#define ss second
#define pb emplace_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(a,b,c) for(int a=b;a<c;a++)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
const ll maxn = 150005;
const ll maxm = 200005;
const ll mod = 1000000007;
void solve(){
int n;
int a[maxn];
int b[maxn];
int c[maxn];
int ans = -1;
cin >> n;
rep(i,0,n) cin >> a[i] >> b[i] >> c[i];
rep(i,0,n) rep(j,i+1,n) rep(k,j+1,n){
vector<pii> A, B, C;
A.pb(a[i],i), A.pb(a[j],j), A.pb(a[k],k);
B.pb(b[i],i), B.pb(b[j],j), B.pb(b[k],k);
C.pb(c[i],i), C.pb(c[j],j), C.pb(c[k],k);
sort(all(A)), sort(all(B)), sort(all(C));
if(A[2].ff==A[1].ff || B[2].ff==B[1].ff || C[2].ff==C[1].ff || A[2].ss==B[2].ss || A[2].ss==C[2].ss || B[2].ss==C[2].ss) continue;
ans = max(ans,A[2].ff+B[2].ff+C[2].ff);
}
cout << ans << endl;
}
int main(){
//freopen("input.txt","r",stdin);
//freopen("sol.txt","w",stdout);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t = 1;
//cin >> t;
while(t--) solve();
}
Compilation message
team.cpp:4: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
4 | #pragma gcc optimize('ofast','unroll-loops')
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
2004 KB |
Output is correct |
12 |
Correct |
1 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
1204 ms |
2060 KB |
Output is correct |
15 |
Correct |
587 ms |
2052 KB |
Output is correct |
16 |
Correct |
860 ms |
2056 KB |
Output is correct |
17 |
Correct |
1189 ms |
2060 KB |
Output is correct |
18 |
Correct |
985 ms |
2064 KB |
Output is correct |
19 |
Correct |
1233 ms |
2060 KB |
Output is correct |
20 |
Correct |
1171 ms |
2064 KB |
Output is correct |
21 |
Correct |
1119 ms |
2052 KB |
Output is correct |
22 |
Correct |
969 ms |
2004 KB |
Output is correct |
23 |
Correct |
1043 ms |
2072 KB |
Output is correct |
24 |
Correct |
1108 ms |
2052 KB |
Output is correct |
25 |
Correct |
1095 ms |
2124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
2004 KB |
Output is correct |
12 |
Correct |
1 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
1204 ms |
2060 KB |
Output is correct |
15 |
Correct |
587 ms |
2052 KB |
Output is correct |
16 |
Correct |
860 ms |
2056 KB |
Output is correct |
17 |
Correct |
1189 ms |
2060 KB |
Output is correct |
18 |
Correct |
985 ms |
2064 KB |
Output is correct |
19 |
Correct |
1233 ms |
2060 KB |
Output is correct |
20 |
Correct |
1171 ms |
2064 KB |
Output is correct |
21 |
Correct |
1119 ms |
2052 KB |
Output is correct |
22 |
Correct |
969 ms |
2004 KB |
Output is correct |
23 |
Correct |
1043 ms |
2072 KB |
Output is correct |
24 |
Correct |
1108 ms |
2052 KB |
Output is correct |
25 |
Correct |
1095 ms |
2124 KB |
Output is correct |
26 |
Execution timed out |
2074 ms |
2004 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2048 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Execution timed out |
2076 ms |
2772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2048 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Execution timed out |
2076 ms |
2772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2048 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Execution timed out |
2076 ms |
2772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2048 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Execution timed out |
2076 ms |
2772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2004 KB |
Output is correct |
2 |
Correct |
1 ms |
2004 KB |
Output is correct |
3 |
Correct |
1 ms |
2004 KB |
Output is correct |
4 |
Correct |
1 ms |
2004 KB |
Output is correct |
5 |
Correct |
1 ms |
2004 KB |
Output is correct |
6 |
Correct |
1 ms |
2004 KB |
Output is correct |
7 |
Correct |
1 ms |
2004 KB |
Output is correct |
8 |
Correct |
1 ms |
2004 KB |
Output is correct |
9 |
Correct |
1 ms |
2004 KB |
Output is correct |
10 |
Correct |
1 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
2004 KB |
Output is correct |
12 |
Correct |
1 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
2004 KB |
Output is correct |
14 |
Correct |
1204 ms |
2060 KB |
Output is correct |
15 |
Correct |
587 ms |
2052 KB |
Output is correct |
16 |
Correct |
860 ms |
2056 KB |
Output is correct |
17 |
Correct |
1189 ms |
2060 KB |
Output is correct |
18 |
Correct |
985 ms |
2064 KB |
Output is correct |
19 |
Correct |
1233 ms |
2060 KB |
Output is correct |
20 |
Correct |
1171 ms |
2064 KB |
Output is correct |
21 |
Correct |
1119 ms |
2052 KB |
Output is correct |
22 |
Correct |
969 ms |
2004 KB |
Output is correct |
23 |
Correct |
1043 ms |
2072 KB |
Output is correct |
24 |
Correct |
1108 ms |
2052 KB |
Output is correct |
25 |
Correct |
1095 ms |
2124 KB |
Output is correct |
26 |
Execution timed out |
2074 ms |
2004 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |