제출 #248435

#제출 시각아이디문제언어결과실행 시간메모리
248435Evirir선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define watch(x) cout<<(#x)<<"="<<(x)<<'\n' #define mset(d,val) memset(d,val,sizeof(d)) #define setp(x) cout<<fixed<<setprecision(x) #define forn(i,a,b) for(int i=(a);i<(b);i++) #define fore(i,a,b) for(int i=(a);i<=(b);i++) #define pb push_back #define F first #define S second #define pqueue priority_queue #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll,ll> ii; typedef vector<ll> vi; typedef vector<ii> vii; typedef long double ld; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds; void amin(ll &a, ll b){ a=min(a,b); } void amax(ll &a, ll b){ a=max(a,b); } void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";} void SD(int t=0){ cout<<"PASSED "<<t<<endl; } const ll INF = ll(1e18); const int MOD = 998244353; bool DEBUG = 0; const int MAXN = 10000005; ll delivery(int n, int K, int L, int a[]) { ll l[n]{}, r[n]{}; forn(i,0,n){ l[i]=a[i]; if(i-K>=0) l[i]+=l[i-K]+a[i]; else l[i]+=min(a[i],L-a[i]); } for(int i=n-1;i>=0;i--){ r[i]=L-a[i]; if(i+K<n) r[i]+=r[i+K]+(L-a[i]); else r[i]+=min(a[i],L-a[i]); } ll ans=INF; amin(ans, r[0]); if(DEBUG) cout<<"i="<<0<<" cur="<<r[0]<<" ans="<<ans<<'\n'; forn(i,0,n-1){ ans = min(ans, l[i]+r[i+1]); if(DEBUG) cout<<"i="<<i+1<<" l="<<l[i]<<" r="<<r[i+1]<<" cur="<<l[i]+r[i+1]<<" ans="<<ans<<'\n'; } amin(ans, l[n-1]); if(DEBUG) cout<<"i="<<n<<" cur="<<l[n-1]<<" ans="<<ans<<'\n'; 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)<<'\n'; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccb6CtBD.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccrNcUki.o:boxes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status