Submission #696714

# Submission time Handle Problem Language Result Execution time Memory
696714 2023-02-07T05:56:07 Z ld_minh4354 Team Contest (JOI22_team) C++17
0 / 100
30 ms 4688 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back



signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//	freopen("input.000","r",stdin);
//	freopen("output.000","w",stdout);
//	srand((unsigned)time(NULL));
//	rand()

	int n,i,cur_num,cur_id,cur_x,fur_x,cur_y,fur_y,j,ans;
	static pair<int,pair<int,int>> a[150005];
	queue<pair<int,int>> q;
	
	cin>>n;
	for (i=1;i<n+1;i++) cin>>a[i].se.fi>>a[i].se.se>>a[i].fi;
	sort(a+1,a+n+1);
	
//	for (i=1;i<n+1;i++) cout<<y[i].fi<<y[i].se.fi<<y[i].se.se<<"\n";
	
	cur_x=cur_y=fur_x=fur_y=0;
	cur_num=a[1].fi;
	cur_id=1;
	ans=-1;
	
	for (i=1;i<n+1;i++)
	{
		if (cur_num < a[i].fi)
		{
			for (j=cur_id; j<i; j++)
			if (a[j].se.fi >= fur_x and a[j].se.se >= fur_y)
			{
				fur_x=a[j].se.fi;
				fur_y=a[j].se.se;
			}
			else
			{
				cur_x=fur_x=max(fur_x,a[j].se.fi);
				cur_y=fur_y=max(fur_y,a[j].se.se);
			}
			
			cur_id=i;
			cur_num=a[i].fi;
		}
		
		if (a[i].se.fi < cur_x and a[i].se.se < cur_y)
		ans=max(ans,a[i].fi + cur_x + cur_y);	 
	}
	
	cout<<ans;
}

# 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 0 ms 212 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 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 0 ms 212 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 328 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 30 ms 4688 KB Output is correct
12 Incorrect 20 ms 3156 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 328 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 30 ms 4688 KB Output is correct
12 Incorrect 20 ms 3156 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 328 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 30 ms 4688 KB Output is correct
12 Incorrect 20 ms 3156 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 328 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 30 ms 4688 KB Output is correct
12 Incorrect 20 ms 3156 KB Output isn't correct
13 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 0 ms 212 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 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -