답안 #100950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100950 2019-03-15T11:46:19 Z AbduM 금 캐기 (IZhO14_divide) C++14
17 / 100
50 ms 4668 KB
/// In the name of GOD
/// I love my MOTHER
/// Only GOLD

#include <bits/stdc++.h>

#define all(x)                  x.begin(), x.end()
#define sz(s)                   (ll)(s.size())
#define pb                      push_back()
#define pf                      push_front()
#define ppb                     pop_back()
#define ppf                     pop_front()
#define F                       first
#define S                       second
#define MP                      make_pair
#define ort1                    exit(0);
#define nl                      "\n"

#define rep(i, l, r)            for(int i = (l); i <= (r); ++i)
#define per(i, l, r)            for(int i = (l); i >= (r); i--)
#define TL                      clock() / (double)CLOCKS_PER_SEC
#define NFS                     ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const double pi = acos(-1.0);
const double eps = 1e-7;
const long long INF = 1e18 + 1;
const int inf = 2e9 + 777;
const int mod = 1e9 + 7;
const int N = 5e5 + 7;

int n;
int a[N];
int g[N];
int e[N];
ll ans;

int main(){
    NFS
    #ifdef ioi
        freopen("in.txt", "r", stdin);
    #else
        //freopen("bank.in", "r", stdin);
            //freopen("bank.out", "w", stdout);
    #endif

    cin >> n;
    rep(i, 1, n){
        cin >> a[i] >> g[i] >> e[i];
    }

    ll gold = g[1];
    ll energy = e[1];
    int l = a[1];
    rep(i, 2, n){
        energy += e[i];
        if(a[i] - l <= energy) gold += g[i];
        else{
            ans = max(ans, gold);
            gold = g[i];
            energy = e[i];
            l = a[i];
        }
    }

    ans = max(ans, gold);

    cout << ans;

    ort1
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 640 KB Output is correct
3 Correct 9 ms 640 KB Output is correct
4 Correct 25 ms 1920 KB Output is correct
5 Correct 23 ms 2424 KB Output is correct
6 Correct 43 ms 4668 KB Output is correct
7 Correct 33 ms 3320 KB Output is correct
8 Correct 50 ms 3448 KB Output is correct
9 Correct 30 ms 3232 KB Output is correct
10 Incorrect 40 ms 3260 KB Output isn't correct
11 Halted 0 ms 0 KB -