답안 #104971

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
104971 2019-04-10T03:16:52 Z Aydarov03 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 2552 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int x[100005];
int g[100005];
int e[100005];



main()
{
	int n , ans = 0;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> x[i] >> g[i] >> e[i];
	}
	
	int gold = 0 , energy = 0;
	for(int i = 1; i <= n; i++)
	{
		gold = 0 , energy = 0;
		for(int j = i; j <= n; j++)
		{
			gold += g[j];
			energy += e[j];
			if(x[j] - x[i] <= energy)
			{
				ans = max(ans , gold);
			}
		}
	}
	
	cout << ans << endl;
}

Compilation message

divide.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 256 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
11 Correct 21 ms 640 KB Output is correct
12 Correct 18 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 512 KB Output is correct
2 Correct 63 ms 620 KB Output is correct
3 Correct 86 ms 688 KB Output is correct
4 Execution timed out 1065 ms 2552 KB Time limit exceeded
5 Halted 0 ms 0 KB -