답안 #100425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100425 2019-03-11T08:46:47 Z AbduM 금 캐기 (IZhO14_divide) C++14
0 / 100
4 ms 512 KB
/// In the name of GOD
/// I love my MOTHER
/// Only GOLD

#include <bits/stdc++.h>

#define sz(s)                   (ll)(s.size())
#define all(x)                  (x.begin(), x.end())
#define pb                      push_back
#define pf                      push_front
#define F                       first
#define S                       second
#define mp                      make_pair
#define ort1                    exit(0);
#define nl                      endl

#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;
typedef long double ld;


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

int n;
int mx;
int x[N];
int g[N];
int d[N];

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

    cin >> n;
    rep(i, 1, n){
        cin >> x[i] >> g[i] >> d[i];
    }

    rep(i, 1, n){
        int e = 0, cost = 0;
        rep(j, i, n){
            e += d[j];
            if(x[j] - x[i] > e) break;
            cost += g[j];
        }
        mx = max(mx, cost);
    }


    cout << mx;

    ort1
}

Compilation message

divide.cpp: In function 'int main()':
divide.cpp:48:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("divide.in", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
divide.cpp:49:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("divide.out", "w", stdout);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -