답안 #17959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17959 2016-01-13T09:51:59 Z Elibay 금 캐기 (IZhO14_divide) C++14
17 / 100
88 ms 2892 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2892 KB Output is correct
2 Correct 0 ms 2892 KB Output is correct
3 Correct 0 ms 2892 KB Output is correct
4 Correct 0 ms 2892 KB Output is correct
5 Correct 0 ms 2892 KB Output is correct
6 Correct 0 ms 2892 KB Output is correct
7 Correct 0 ms 2892 KB Output is correct
8 Correct 0 ms 2892 KB Output is correct
9 Correct 0 ms 2892 KB Output is correct
10 Correct 0 ms 2892 KB Output is correct
11 Correct 1 ms 2892 KB Output is correct
12 Correct 0 ms 2892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2892 KB Output is correct
2 Correct 0 ms 2892 KB Output is correct
3 Incorrect 0 ms 2892 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2892 KB Output is correct
2 Correct 88 ms 2892 KB Output is correct
3 Incorrect 85 ms 2892 KB Output isn't correct
4 Halted 0 ms 0 KB -