이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5 + 17;
int n, ind = 1, Sum, Max, Sz;
pair < int, pair < int, int > > p[MaxN];
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
scanf ("%d", &n);
for (int i = 1; i <= n; ++ i)
scanf ("%d%d%d", &p[i].first, &p[i].second.second, &p[i].second.first);
sort (p + 1, p + n + 1);
for (int i = 1; i <= n; ++ i)
{
Sum = p[i].second.second;
Sz = p[i].second.first + p[i].first;
for (int j = i + 1; j <= n; ++ j)
{
if (Sz + p[j].second.first >= p[j].first)
{
Sum += p[j].second.second;
Sz += p[j].second.first;
}
}
Max = max (Max, Sum);
}
cout << Max;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |