Submission #412930

#TimeUsernameProblemLanguageResultExecution timeMemory
412930ScarletSBoxes with souvenirs (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int INF = 2e9+7; ll delivery(int n, int k, int l, int p[]) { int x=0,y=n-1; ll ans=0; for (int i=k-1;i<n;i+=k) { if (p[i]>(l-1)/2) break; x=i+1; ans+=p[i]*2; //cout<<p[i]*2<<"!\n"; } for (int i=n-k;i>=0;i-=k) { if (p[i]<(l+2)/2) break; y=i-1; ans+=(l-p[i])*2; //cout<<(l-p[i])*2<<"!\n"; } //cout<<x<<" "<<y<<"\n"; ans+=1LL*((y-x+k)/k)*l; return ans; } int main() { int n,k,l; cin>>n>>k>>l; int p[n]; for (int i=0;i<n;++i) cin>>p[i]; cout<<delivery(n,k,l,p); }

Compilation message (stderr)

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