Submission #917485

# Submission time Handle Problem Language Result Execution time Memory
917485 2024-01-28T10:12:55 Z manishjha91 Team Contest (JOI22_team) C++17
8 / 100
2000 ms 2140 KB
#include<bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using lld = long double;

void solve()
{
	int n;
	cin >> n;

	vector<array<int,3>> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i][0]>>a[i][1]>>a[i][2];
	}
	
	sort(a.begin(),a.end());
	
	int ans = -1;
	for(int i=0; i<n; i++)
	{
		for(int j=i+1; j<n; j++)
		{
			for(int k=j+1; k<n; k++)
			{
				if(a[k][1]>=max(a[i][1],a[j][1])) continue;
				if(a[k][2]>=max(a[i][2],a[j][2])) continue;
				if(a[k][0]==max(a[i][0],a[j][0])) continue;
				if(a[i][1]>a[j][1] && a[i][2]<a[j][2])
				{
					ans = max(ans, a[k][0] + a[i][1] + a[j][2]);
				}
				else if(a[i][1]<a[j][1] && a[i][2]>a[j][2])
				{
					ans = max(ans, a[k][0] + a[j][1] + a[i][2]);
				}
				
			}
		}
	}
	
	cout<<ans<<"\n";
	
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

// #ifndef ONLINE_JUDGE
// 	freopen("error.txt", "w", stderr);
// #endif

	int tt = 1;
	// cin >> tt;
	while (tt--)
	{
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 14 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 7 ms 348 KB Output is correct
17 Correct 7 ms 348 KB Output is correct
18 Correct 10 ms 344 KB Output is correct
19 Correct 12 ms 348 KB Output is correct
20 Correct 7 ms 348 KB Output is correct
21 Correct 3 ms 464 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 14 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 7 ms 348 KB Output is correct
17 Correct 7 ms 348 KB Output is correct
18 Correct 10 ms 344 KB Output is correct
19 Correct 12 ms 348 KB Output is correct
20 Correct 7 ms 348 KB Output is correct
21 Correct 3 ms 464 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Execution timed out 2103 ms 856 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2053 ms 2140 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2053 ms 2140 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2053 ms 2140 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 2053 ms 2140 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 14 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 7 ms 348 KB Output is correct
17 Correct 7 ms 348 KB Output is correct
18 Correct 10 ms 344 KB Output is correct
19 Correct 12 ms 348 KB Output is correct
20 Correct 7 ms 348 KB Output is correct
21 Correct 3 ms 464 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Execution timed out 2103 ms 856 KB Time limit exceeded
27 Halted 0 ms 0 KB -