제출 #90503

#제출 시각아이디문제언어결과실행 시간메모리
90503daniel_02금 캐기 (IZhO14_divide)C++14
48 / 100
17 ms1304 KiB
#include <bits/stdc++.h>

#define fr first
#define pb push_back
#define sc second
#define ll long long

using namespace std;

const int N = 5005;

pair<int, pair<int, int>> a[N];
ll pre[N], prg[N], ans;

main()
{
	int n;
	
	cin >> n;
	
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d%d", &a[i].fr, &a[i].sc.fr, &a[i].sc.sc);
		pre[i] = pre[i - 1] + a[i].sc.sc;
		prg[i] = prg[i - 1] + a[i].sc.fr;
	}
	
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j <= n; j++)
		{
			if (a[j].fr - a[i].fr <= pre[j] - pre[i - 1])
			{
				if (ans < prg[j] - prg[i - 1])
				{
					ans = prg[j] - prg[i - 1];
				}
			}
		}
	}
	cout << ans;
}

컴파일 시 표준 에러 (stderr) 메시지

divide.cpp:15:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
divide.cpp: In function 'int main()':
divide.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &a[i].fr, &a[i].sc.fr, &a[i].sc.sc);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...