Submission #535445

#TimeUsernameProblemLanguageResultExecution timeMemory
535445mario05092929Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define all(v) v.begin(),v.end() #pragma gcc optimize("O3") #pragma gcc optimize("Ofast") #pragma gcc optimize("unroll-loops") using namespace std; const int INF = 1e9; const int TMX = 1 << 18; const long long llINF = 1e16; const long long mod = 1e9+7; const long long hashmod = 100003; const int MAXN = 100000; const int MAXM = 1000000; typedef long long ll; typedef long double ld; typedef pair <int,int> pi; typedef pair <ll,ll> pl; typedef vector <int> vec; typedef vector <pi> vecpi; typedef long long ll; int n,k,L; int a[10000005]; ll dl[10000005],dr[30000005]; ll rans; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> k >> L; for(int i = 1;i <= n;i++) { cin >> a[i]; } for(int i = 1;i <= n;i++) { dl[i] = (i <= k ? 0 : dl[i-k])+a[i]*2; } for(int i = n;i >= 1;i--) { dr[i] = (i > n-k ? 0 : dr[i+k])+(L-a[i])*2; } ll rans = llINF; for(int i = 0;i <= n;i++) { rans = min({rans,dl[i]+dr[i+1],dl[i]+L+dr[i+k+1],dl[i]+L*2+dr[i+2*k+1]}); } cout << rans; }

Compilation message (stderr)

boxes.cpp:6: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    6 | #pragma gcc optimize("O3")
      | 
boxes.cpp:7: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    7 | #pragma gcc optimize("Ofast")
      | 
boxes.cpp:8: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    8 | #pragma gcc optimize("unroll-loops")
      | 
boxes.cpp: In function 'int main()':
boxes.cpp:41:5: warning: declaration of 'rans' shadows a global declaration [-Wshadow]
   41 |  ll rans = llINF;
      |     ^~~~
boxes.cpp:27:4: note: shadowed declaration is here
   27 | ll rans;
      |    ^~~~
/usr/bin/ld: /tmp/ccvf5JRs.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/cc6DdWCt.o:boxes.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccvf5JRs.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status