Submission #1138606

#TimeUsernameProblemLanguageResultExecution timeMemory
1138606bekzhan29Bulldozer (JOI17_bulldozer)C++20
5 / 100
1 ms528 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define INF (long long)(2e9)
#define mod2 998244353
#define mod 1000000007
#define eps 1e-9
#define abs(x) ((x)>=0?(x):-(x))
#define y1 solai
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef pair<pll, ll> plll;
mt19937 rng(29);
const ll N=2100;
ll n,ch=1,ans;
struct point
{
	ll x,y,w;
}a[N];
bool cmp_x(point a, point b)
{
	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i].x>>a[i].y>>a[i].w;
		ch&=a[i].y==0;
	}
	ch=1;
	if(ch)
	{
		sort(a+1,a+n+1,&cmp_x);
		for(ll i=1;i<=n;i++)
		{
			ll sum=0;
			for(ll j=i;j<=n;j++)
				sum+=a[j].w,ans=max(ans,sum);
		}
		cout<<ans;
		return 0;
	}
}
/*
5
-5 0 -2
-2 0 7
1 0 -2
2 0 10
4 0 4

*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...