Submission #1206347

#TimeUsernameProblemLanguageResultExecution timeMemory
1206347_callmelucianCircus (Balkan15_CIRCUS)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#ifndef LOCAL
    #include "circus.h"
#endif // LOCAL
using namespace std;

using ll = long long;
using ld = long double;
using pl = pair<ll,ll>;
using pii = pair<int,int>;
using tpl = tuple<int,int,int>;

#define all(a) a.begin(), a.end()
#define filter(a) a.erase(unique(all(a)), a.end())

const int mn = 1e5 + 5;
int p[mn], dp[mn], m, n;

void init (int N, int M, vector<int> P) {
    for (int &u : P) u = M - u;
    P.push_back(0);
    sort(all(P));

    n = N + 1, m = M;
    for (int i = 0; i < n; i++) p[i] = P[i];
    for (int i = 1; i < n; i++) {
        dp[i] = INT_MAX;
        for (int j = 0; j < i; j++)
            if (dp[j] <= P[i] - P[j])
                dp[i] = min(dp[i], P[i] - P[j]);
    }
}

int minLength (int D) {
    D = m - D;
    int ans = INT_MAX;
    for (int i = 0; i < n && p[i] <= D; i++)
        if (dp[i] <= D - p[i]) ans = min(ans, D - p[i]);
    return ans;
}

#ifdef LOCAL
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    vector<int> P = {0, 3, 6};
    init(3, 8, P);
    cout << minLength(4) << " " << minLength(5) << "\n";

    return 0;
}
#endif // LOCAL

Compilation message (stderr)

grader.cpp: In function 'int main()':
grader.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d%d", &N, &M);
      |         ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |                 scanf("%d", &P[i]);
      |                 ~~~~~^~~~~~~~~~~~~
grader.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%d", &Q);
      |         ~~~~~^~~~~~~~~~
grader.cpp:23:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |                 scanf("%d", &d);
      |                 ~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccLkhFns.o: in function `main':
grader.cpp:(.text.startup+0x80): undefined reference to `init(int, int, int*)'
collect2: error: ld returned 1 exit status