답안 #275140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
275140 2020-08-20T04:36:43 Z 임성재(#5103) Happiness (Balkan15_HAPPINESS) C++17
컴파일 오류
0 ms 0 KB
#include "circus.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;

int n, m;
int dp[100010];
vector<int> p;

void init(int N, int M, int P[]){
    n = N;
    m = M;

    for(int i=0; i<N; i++) p.eb(P[i]);

    sort(all(p));

    for(int i = n-1; i>=0; i--) {
        dp[i] = m - p[i];

        for(int j=i+1; j<n; j++) {
            if(dp[j] > p[j] - p[i]) continue;
            dp[i] = min(dp[i], p[j] - p[i]);
        }
    }
}

int minLength(int D) {
    int k = lower_bound(all(p), D) - p.begin();

    int ret = m - D;
    for(int i=k; i<n; i++) {
        if(p[i] - D < dp[i]) continue;

        ret = min(ret, p[i] - D);
    }

    return ret;
}

Compilation message

happiness.cpp:1:10: fatal error: circus.h: No such file or directory
    1 | #include "circus.h"
      |          ^~~~~~~~~~
compilation terminated.
grader.cpp: In function 'int main()':
grader.cpp:14:9: warning: unused variable 'd' [-Wunused-variable]
   14 |  int i, d;
      |         ^
grader.cpp:15:12: warning: unused variable 'max_code' [-Wunused-variable]
   15 |  long long max_code;
      |            ^~~~~~~~
grader.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |  scanf("%d%lld", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
grader.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |   scanf("%lld", &coins[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
grader.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
grader.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |   scanf("%d%d", &ck, &c);
      |   ~~~~~^~~~~~~~~~~~~~~~~
grader.cpp:28:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   28 |    scanf("%lld", &A[j]);
      |    ~~~~~^~~~~~~~~~~~~~~