Submission #90046

#TimeUsernameProblemLanguageResultExecution timeMemory
90046psmaoBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define fo(i,s,t) for(int i = s; i <= t; ++ i) #define fd(i,s,t) for(int i = s; i >= t; -- i) #define bf(i,s) for(int i = head[s]; i; i = e[i].next) #define mp make_pair #define fi first #define se second #define pii pair<int,int> #define pb push_back #define VI vector<int> #define sf scanf #define pf printf #define fp freopen #define SZ(x) ((int)(x).size()) #ifdef MPS #define D(x...) printf(x) #else #define D(x...) #endif typedef long long ll; typedef double db; typedef unsigned long long ull; const int inf = 1<<30; const ll INF = 1ll<<60; const db Inf = 1e20; const db eps = 1e-9; void gmax(int &a,int b){a = (a > b ? a : b);} void gmin(int &a,int b){a = (a < b ? a : b);} const int maxn = 10000050; int n, K, L, pos[maxn]; ll wl[maxn], wr[maxn], ans; int main() { #ifdef MPS fp("1.in","r",stdin); fp("1.out","w",stdout); #endif sf("%d%d%d",&n,&K,&L); fo(i,1,n) sf("%d",&pos[i]); fo(i,1,n) wl[i] = wl[max(0,i-K)] + pos[i]*2; fd(i,n,1) wr[i] = wr[min(n+1,i+K)] + (L-pos[i])*2; ans = INF; fo(i,0,n) ans = min(ans, wl[i] + wr[i+1]); fo(i,0,n-K) ans = min(ans, wl[i] + wr[i+K+1] + L); cout << ans << endl; return 0; }

Compilation message (stderr)

boxes.cpp: In function 'int main()':
boxes.cpp:44:4: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  sf("%d%d%d",&n,&K,&L);
    ^
boxes.cpp:45:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  fo(i,1,n) sf("%d",&pos[i]);
              ^
/tmp/ccXAJEYY.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/cccBNJbJ.o:boxes.cpp:(.text.startup+0x0): first defined here
/tmp/ccXAJEYY.o: In function `main':
grader.c:(.text.startup+0x22f): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status