답안 #344655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344655 2021-01-06T07:12:11 Z shmad 금 캐기 (IZhO14_divide) C++14
17 / 100
1 ms 364 KB
#include <bits/stdc++.h>
 
#define nl '\n'
#define pb push_back
#define E exit(0)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define sz(s) (s).size()

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
 
const int N=5e5+5;
const int INF=1e9+7;
const int eps=1e-6;

void solve() {
	int n;
	cin>>n;
	int x[n+1],g[n+1],d[n+1];
	for (int i=1;i<=n;i++) cin>>x[i]>>g[i]>>d[i];
	int mx=0;
	for (int i=1;i<=n;i++) {
		int x1,d1,g1;
		x1=0;
		d1=d[i];
		g1=g[i];
		for (int j=i+1;j<=n;j++) {
			x1+=x[j]-x[j-1];
			d1+=d[j];
			if (d1>=x1) g1+=g[j];
		}
		mx=max(mx,g1);
	}
	cout<<mx;
	cout<<nl;
}

ll test=1;

int main () {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    ios_base::sync_with_stdio(0);
	cin.tie();
//	cin>>test;
    while (test--) solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -