답안 #890415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890415 2023-12-21T06:47:35 Z vjudge1 금 캐기 (IZhO14_divide) C++17
48 / 100
1000 ms 1624 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;
	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;
}
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 1 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
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 1 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 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 9 ms 584 KB Output is correct
24 Correct 9 ms 348 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 1 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 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 9 ms 584 KB Output is correct
24 Correct 9 ms 348 KB Output is correct
25 Correct 14 ms 348 KB Output is correct
26 Correct 53 ms 604 KB Output is correct
27 Correct 53 ms 708 KB Output is correct
28 Execution timed out 1051 ms 1624 KB Time limit exceeded
29 Halted 0 ms 0 KB -