Submission #479866

#TimeUsernameProblemLanguageResultExecution timeMemory
479866ntabc05101Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; #define taskname "CAKES" const int mxN = 1000000; long long delivery(int n, int k, int l, vector<int> P) { vector<int> p; for (auto &x: P) { if (x != 0) { p.push_back(x); } } n = p.size(); //return 0; vector<long long> dp_cw(n), dp_ccw(n); for (int i = 0; i < n; i++) { if (i < k) { dp_cw[i] = min(l, 2 * p[i]); } else { dp_cw[i] = min(l, 2 * p[i]) + dp_cw[i - k]; } } for (int i = n - 1; i >= 0; i--) { if (i >= n - k) { dp_ccw[i] = min(l, 2 * (l - p[i])); } else { dp_ccw[i] = min(l, 2 * (l - p[i])) + dp_ccw[i + k]; } } long long res = min(dp_cw[n - 1], dp_ccw[0]); for (int i = 1; i < n; i++) { res = min(res, dp_cw[i - 1] + dp_ccw[i]); } return res; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, std::vector<int>)':
boxes.cpp:16:13: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   16 |   n = p.size();
      |       ~~~~~~^~
/usr/bin/ld: /tmp/ccCEmZQl.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status