Submission #563581

#TimeUsernameProblemLanguageResultExecution timeMemory
563581hoanghq2004Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "boxes.h" using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 1e7 + 10; long long f[N], g[N]; int p[N]; long long delivery(int n, int k, int l, vector <int> P) { for (int i = 0; i < n; ++i) p[i + 1] = P[i]; for (int i = 1; i <= n; ++i) f[i] = f[max(0, i - k)] + 2 * p[i]; for (int i = n; i >= 1; --i) g[i] = g[min(n + 1, i + k)] + 2 * (l - p[i]); long long ans = 1e18; k = min(k, n); for (int i = 1; i <= n; ++i) ans = min(ans, f[i] + g[i + 1]); for (int i = 1; i <= n; ++i) { for (int j = i; j <= n; ++j) { int t = ceil(1.0L * (j - i + 1) / k); ans = min(ans, f[i - 1] + g[i + 1] + 1LL * t * l); } } return ans; } // //int main() { // ios :: sync_with_stdio(0); cin.tie(0); // int n, k, l; // cin >> n >> k >> l; // vector <int> p(n); // for (int i = 0; i < n; ++i) cin >> p[i]; // cout << delivery(n, k, l, p); //}

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, std::vector<int>)':
boxes.cpp:29:25: warning: conversion from 'long double' to 'int' may change value [-Wfloat-conversion]
   29 |             int t = ceil(1.0L * (j - i + 1) / k);
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccj6bmoj.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status