Submission #587528

# Submission time Handle Problem Language Result Execution time Memory
587528 2022-07-02T04:42:55 Z Tekor Team Contest (JOI22_team) C++17
8 / 100
2000 ms 5228 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
void boos() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
const int N = 3e5 + 100;
ll a[N],b[N],c[N];
int n;
bool cmp(int x,int y) {
	return a[x] < a[y];
}
bool cmp1(int x,int y) {
	return b[x] < b[y];
}
void solve() {
	cin >> n;
	vector <int> g,q;
	for(int i = 1;i <= n;i++) {
		cin >> a[i] >> b[i] >> c[i];
		g.pb(i);
		q.pb(i);
	}
	sort(all(g),cmp);
	sort(all(q),cmp1);
	ll ans = -1;
	for(auto v : g) {
		ll mxa = a[v];
		for(auto to : q) {
			ll mxb = b[to];
			if(a[to] >= mxa || b[v] >= mxb)continue;
			for(int j = 1;j <= n;j++) {
				if(a[j] < mxa && b[j] < mxb && c[j] > max(c[v],c[to])) {
					ans = max(ans,mxa + mxb + c[j]);
				}
			}
		}
	} 
	cout << ans;
}
int main() {
	boos();
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 21 ms 360 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 9 ms 344 KB Output is correct
17 Correct 8 ms 332 KB Output is correct
18 Correct 15 ms 372 KB Output is correct
19 Correct 17 ms 368 KB Output is correct
20 Correct 9 ms 372 KB Output is correct
21 Correct 4 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 352 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 21 ms 360 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 9 ms 344 KB Output is correct
17 Correct 8 ms 332 KB Output is correct
18 Correct 15 ms 372 KB Output is correct
19 Correct 17 ms 368 KB Output is correct
20 Correct 9 ms 372 KB Output is correct
21 Correct 4 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 352 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Execution timed out 2083 ms 596 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Execution timed out 2077 ms 5228 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Execution timed out 2077 ms 5228 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Execution timed out 2077 ms 5228 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Execution timed out 2077 ms 5228 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 21 ms 360 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 9 ms 344 KB Output is correct
17 Correct 8 ms 332 KB Output is correct
18 Correct 15 ms 372 KB Output is correct
19 Correct 17 ms 368 KB Output is correct
20 Correct 9 ms 372 KB Output is correct
21 Correct 4 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 352 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Execution timed out 2083 ms 596 KB Time limit exceeded
27 Halted 0 ms 0 KB -