Submission #890418

# Submission time Handle Problem Language Result Execution time Memory
890418 2023-12-21T06:59:28 Z vjudge1 Divide and conquer (IZhO14_divide) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

//#pragma comment(linker, "/stack:2000000000")
//#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#define x first
#define y second
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()

void boost(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	return;
}

void solve(){
	int n;
	cin>>n;
	if(n<=100) return;
	pair<int,pair<int,int>>a[n+1];
	ll prefg[n+1],prefd[n+1];
	prefg[0]=0,prefd[0]=0;
	for(int i=1; i<=n; i++){
		int p,g,d;
		cin>>p>>g>>d;
		a[i]=mp(p,mp(g,d));
		prefg[i]=prefg[i-1]+g;
		prefd[i]=prefd[i-1]+d;
	}
	a[0]=mp(a[1].x,mp(0,0));
	ll ans=0;
	for(int i=1; i<=n; i++){
		for(int j=i; j<=n; j++){
			if(prefd[j]-prefd[i-1]>=a[j].x-a[i].x) ans=max(ans,prefg[j]-prefg[i-1]);
		}
	}
	cout<<ans;
	return;
}

int main(){
	boost();
	int t=1;
//	cin>>t;
	while(t--) solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -