Submission #688239

# Submission time Handle Problem Language Result Execution time Memory
688239 2023-01-27T09:09:47 Z dkblossom Team Contest (JOI22_team) C++14
8 / 100
1291 ms 468 KB
#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 = 1005;
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 0 ms 212 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 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 1 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1291 ms 312 KB Output is correct
15 Correct 574 ms 332 KB Output is correct
16 Correct 867 ms 340 KB Output is correct
17 Correct 1195 ms 332 KB Output is correct
18 Correct 992 ms 312 KB Output is correct
19 Correct 1201 ms 312 KB Output is correct
20 Correct 1222 ms 308 KB Output is correct
21 Correct 1117 ms 320 KB Output is correct
22 Correct 970 ms 320 KB Output is correct
23 Correct 1067 ms 316 KB Output is correct
24 Correct 1048 ms 316 KB Output is correct
25 Correct 1095 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 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 1 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1291 ms 312 KB Output is correct
15 Correct 574 ms 332 KB Output is correct
16 Correct 867 ms 340 KB Output is correct
17 Correct 1195 ms 332 KB Output is correct
18 Correct 992 ms 312 KB Output is correct
19 Correct 1201 ms 312 KB Output is correct
20 Correct 1222 ms 308 KB Output is correct
21 Correct 1117 ms 320 KB Output is correct
22 Correct 970 ms 320 KB Output is correct
23 Correct 1067 ms 316 KB Output is correct
24 Correct 1048 ms 316 KB Output is correct
25 Correct 1095 ms 308 KB Output is correct
26 Runtime error 2 ms 468 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Runtime error 1 ms 464 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Runtime error 1 ms 464 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Runtime error 1 ms 464 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Runtime error 1 ms 464 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 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 1 ms 324 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1291 ms 312 KB Output is correct
15 Correct 574 ms 332 KB Output is correct
16 Correct 867 ms 340 KB Output is correct
17 Correct 1195 ms 332 KB Output is correct
18 Correct 992 ms 312 KB Output is correct
19 Correct 1201 ms 312 KB Output is correct
20 Correct 1222 ms 308 KB Output is correct
21 Correct 1117 ms 320 KB Output is correct
22 Correct 970 ms 320 KB Output is correct
23 Correct 1067 ms 316 KB Output is correct
24 Correct 1048 ms 316 KB Output is correct
25 Correct 1095 ms 308 KB Output is correct
26 Runtime error 2 ms 468 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -