Submission #563103

#TimeUsernameProblemLanguageResultExecution timeMemory
563103CyberSleeperBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
//#include "boxes.h" #include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl #define all(x) x.begin(), x.end() #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define ull unsigned long long #define pll pair<ll, ll> #define pii pair<ll, ll> #define ld long double #define nl endl #define tb '\t' #define sp ' ' #define sqr(x) (x)*(x) #define arr3 array<ll, 3> using namespace std; const ll MX=200005, MOD=1000000007, BLOCK=160, INF=1e9+7, LG=62; const ll INFF=1000000000000000004; const ld ERR=1e-6, pi=3.14159265358979323846; long long delivery(int N, int K, int L, int p[]) { ll pref[N], suff[N], ans; for(int i=0; i<N; i++){ pref[i]=2*p[i]; if(i>=K){ pref[i]=min(pref[i], (ll)L); pref[i]+=pref[i-K]; } } ans=pref[N-1]; for(int i=N-1; i>=0; i--){ suff[i]=2*(L-p[i]); if(i+K<N){ suff[i]=min(suff[i], (ll)L); suff[i]+=suff[i+K]; } ans=min(ans, suff[i]+(i ? pref[i-1] : 0)); } return ans; } int main() { int N, K, L, i; cin >> N >> K >> L; int *p = (int*)malloc(sizeof(int) * (unsigned int)N); for (i = 0; i < N; i++) { cin >> p[i]; } cout << delivery(N, K, L, p) << nl; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccTHwrdh.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccODfkBi.o:boxes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status